Table of Contents

Class IceDecoderExtensions

Namespace
IceRpc.Ice.Codec
Assembly
IceRpc.dll

Provides extension methods for IceDecoder to decode sequences or dictionaries.

public static class IceDecoderExtensions
Inheritance
IceDecoderExtensions
Inherited Members

Methods

CheckEndOfBuffer(ref IceDecoder)

Verifies the Ice decoder has reached the end of its underlying buffer.

public static void CheckEndOfBuffer(this ref IceDecoder decoder)

Parameters

decoder IceDecoder

The Ice decoder.

DecodeCollection<TCollection, TElement>(ref IceDecoder, Func<int, TCollection>, Action<TCollection, TElement>, DecodeFunc<TElement>)

Decodes an Ice sequence mapped to a custom collection.

public static TCollection DecodeCollection<TCollection, TElement>(this ref IceDecoder decoder, Func<int, TCollection> collectionFactory, Action<TCollection, TElement> addElement, DecodeFunc<TElement> decodeFunc)

Parameters

decoder IceDecoder

The Ice decoder.

collectionFactory Func<int, TCollection>

A delegate used to create the collection with the specified capacity.

addElement Action<TCollection, TElement>

A delegate used to add each decoded element to the collection.

decodeFunc DecodeFunc<TElement>

The decode function for each element of the collection.

Returns

TCollection

The decoded collection.

Type Parameters

TCollection

The type of the returned collection.

TElement

The type of the elements in the collection.

DecodeDictionary<TDictionary, TKey, TValue>(ref IceDecoder, Func<int, TDictionary>, DecodeFunc<TKey>, DecodeFunc<TValue>)

Decodes a dictionary.

public static TDictionary DecodeDictionary<TDictionary, TKey, TValue>(this ref IceDecoder decoder, Func<int, TDictionary> dictionaryFactory, DecodeFunc<TKey> keyDecodeFunc, DecodeFunc<TValue> valueDecodeFunc) where TDictionary : IDictionary<TKey, TValue> where TKey : notnull

Parameters

decoder IceDecoder

The Ice decoder.

dictionaryFactory Func<int, TDictionary>

The factory for creating the dictionary instance.

keyDecodeFunc DecodeFunc<TKey>

The decode function for each key of the dictionary.

valueDecodeFunc DecodeFunc<TValue>

The decode function for each value of the dictionary.

Returns

TDictionary

The dictionary decoded by this decoder.

Type Parameters

TDictionary

The type of the returned dictionary.

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

DecodeLinkedList<TElement>(ref IceDecoder, DecodeFunc<TElement>)

Decodes an Ice sequence mapped to a LinkedList<T>.

public static LinkedList<TElement> DecodeLinkedList<TElement>(this ref IceDecoder decoder, DecodeFunc<TElement> decodeFunc)

Parameters

decoder IceDecoder

The Ice decoder.

decodeFunc DecodeFunc<TElement>

The decode function for each element of the sequence.

Returns

LinkedList<TElement>

A LinkedList<T>.

Type Parameters

TElement

The type of the elements in the sequence.

DecodeList<TElement>(ref IceDecoder, DecodeFunc<TElement>)

Decodes an Ice sequence mapped to a List<T>.

public static List<TElement> DecodeList<TElement>(this ref IceDecoder decoder, DecodeFunc<TElement> decodeFunc)

Parameters

decoder IceDecoder

The Ice decoder.

decodeFunc DecodeFunc<TElement>

The decode function for each element of the sequence.

Returns

List<TElement>

A List<T>.

Type Parameters

TElement

The type of the elements in the sequence.

DecodeQueue<TElement>(ref IceDecoder, DecodeFunc<TElement>)

Decodes an Ice sequence mapped to a Queue<T>.

public static Queue<TElement> DecodeQueue<TElement>(this ref IceDecoder decoder, DecodeFunc<TElement> decodeFunc)

Parameters

decoder IceDecoder

The Ice decoder.

decodeFunc DecodeFunc<TElement>

The decode function for each element of the sequence.

Returns

Queue<TElement>

A Queue<T>.

Type Parameters

TElement

The type of the elements in the sequence.

DecodeSequence<T>(ref IceDecoder, DecodeFunc<T>)

Decodes a sequence.

public static T[] DecodeSequence<T>(this ref IceDecoder decoder, DecodeFunc<T> decodeFunc)

Parameters

decoder IceDecoder

The Ice decoder.

decodeFunc DecodeFunc<T>

The decode function for each element of the sequence.

Returns

T[]

An array of T.

Type Parameters

T

The type of the elements in the array.

DecodeSequence<T>(ref IceDecoder, Action<T>?)

Decodes a sequence of fixed-size numeric values.

public static T[] DecodeSequence<T>(this ref IceDecoder decoder, Action<T>? checkElement = null) where T : struct

Parameters

decoder IceDecoder

The Ice decoder.

checkElement Action<T>

A delegate used to check each element of the array (optional).

Returns

T[]

An array of T.

Type Parameters

T

The sequence element type.

DecodeStack<TElement>(ref IceDecoder, DecodeFunc<TElement>)

Decodes an Ice sequence mapped to a Stack<T>.

public static Stack<TElement> DecodeStack<TElement>(this ref IceDecoder decoder, DecodeFunc<TElement> decodeFunc)

Parameters

decoder IceDecoder

The Ice decoder.

decodeFunc DecodeFunc<TElement>

The decode function for each element of the sequence.

Returns

Stack<TElement>

A Stack<T>.

Type Parameters

TElement

The type of the elements in the sequence.