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
fieldsIDictionary<TKey, ReadOnlySequence<byte>>The field dictionary.
keyTKeyThe key to lookup in the field dictionary.
decodeFuncDecodeFunc<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
TKeyThe type of the field keys.
TValueThe 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
fieldsIDictionary<TKey, OutgoingFieldValue>A fields dictionary.
keyTKeyThe key of the entry to set.
valueReadOnlySequence<byte>The value of the entry to set.
Returns
- IDictionary<TKey, OutgoingFieldValue>
The fields dictionary.
Type Parameters
TKeyThe 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
fieldsIDictionary<TKey, OutgoingFieldValue>A fields dictionary.
keyTKeyThe key of the entry to set.
valueTValueThe value of the entry to set.
encodeActionEncodeAction<TValue>The encode action.
encodingSliceEncodingThe encoding.
Returns
- IDictionary<TKey, OutgoingFieldValue>
The fields dictionary.
Type Parameters
TKeyThe type of the field key.
TValueThe 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
fieldsIDictionary<TKey, OutgoingFieldValue>A fields dictionary.
keyTKeyThe key of the entry to check.
Returns
- IDictionary<TKey, OutgoingFieldValue>
The fields dictionary.
Type Parameters
TKeyThe type of the field key.