Table of Contents

Class FieldsExtensions

Namespace
IceRpc
Assembly
IceRpc.dll

Provides extension method for field dictionaries.

public static class FieldsExtensions
Inheritance
FieldsExtensions
Inherited Members

Methods

DecodeValue<TKey, TValue>(IDictionary<TKey, ReadOnlySequence<byte>>, TKey, DecodeFunc<TValue>)

Retrieves the decoded field value associated with a field key.

public static TValue? DecodeValue<TKey, TValue>(this IDictionary<TKey, ReadOnlySequence<byte>> fields, TKey key, DecodeFunc<TValue> decodeFunc) where TKey : struct

Parameters

fields IDictionary<TKey, ReadOnlySequence<byte>>

The field dictionary.

key TKey

The key to lookup in the field dictionary.

decodeFunc DecodeFunc<TValue>

The function used to decode the field value.

Returns

TValue

The decoded field value, or default if the key was not found in fields.

Type Parameters

TKey

The type of the field keys.

TValue

The type of the decoded field value.

With<TKey>(IDictionary<TKey, OutgoingFieldValue>, TKey, ReadOnlySequence<byte>)

Sets an entry in the outgoing fields dictionary and returns the fields dictionary. If fields is read-only, a copy is created, modified then returned.

public static IDictionary<TKey, OutgoingFieldValue> With<TKey>(this IDictionary<TKey, OutgoingFieldValue> fields, TKey key, ReadOnlySequence<byte> value) where TKey : struct

Parameters

fields IDictionary<TKey, OutgoingFieldValue>

A fields dictionary.

key TKey

The key of the entry to set.

value ReadOnlySequence<byte>

The value of the entry to set.

Returns

IDictionary<TKey, OutgoingFieldValue>

The fields dictionary.

Type Parameters

TKey

The type of the field key.

With<TKey, TValue>(IDictionary<TKey, OutgoingFieldValue>, TKey, TValue, EncodeAction<TValue>, SliceEncoding)

Sets an entry in the outgoing fields dictionary and returns the fields dictionary. If fields is read-only, a copy is created, modified and then returned.

public static IDictionary<TKey, OutgoingFieldValue> With<TKey, TValue>(this IDictionary<TKey, OutgoingFieldValue> fields, TKey key, TValue value, EncodeAction<TValue> encodeAction, SliceEncoding encoding = SliceEncoding.Slice2) where TKey : struct

Parameters

fields IDictionary<TKey, OutgoingFieldValue>

A fields dictionary.

key TKey

The key of the entry to set.

value TValue

The value of the entry to set.

encodeAction EncodeAction<TValue>

The encode action.

encoding SliceEncoding

The encoding.

Returns

IDictionary<TKey, OutgoingFieldValue>

The fields dictionary.

Type Parameters

TKey

The type of the field key.

TValue

The type of the value to encode.

Without<TKey>(IDictionary<TKey, OutgoingFieldValue>, TKey)

Removes an entry in the fields dictionary and returns the fields dictionary. If fields is read-only and contains the value, a copy is created, modified then returned.

public static IDictionary<TKey, OutgoingFieldValue> Without<TKey>(this IDictionary<TKey, OutgoingFieldValue> fields, TKey key) where TKey : struct

Parameters

fields IDictionary<TKey, OutgoingFieldValue>

A fields dictionary.

key TKey

The key of the entry to check.

Returns

IDictionary<TKey, OutgoingFieldValue>

The fields dictionary.

Type Parameters

TKey

The type of the field key.