Class SerializerProviderExtensions
Extension methods for ISerializerProvider<TKey, TSerializer>.
Namespace: TehGM.Wolfringo.Messages.Serialization
Assembly: Wolfringo.Core.dll
Syntax
public static class SerializerProviderExtensions
Methods
| Improve this Doc View SourceGetSerializer<TKey, TSerializer>(ISerializerProvider<TKey, TSerializer>, TKey)
Gets serializer mapped to the key. If not found, will return fallback serializer.
Declaration
public static TSerializer GetSerializer<TKey, TSerializer>(this ISerializerProvider<TKey, TSerializer> provider, TKey key)
Parameters
Type | Name | Description |
---|---|---|
ISerializerProvider<TKey, TSerializer> | provider | Provider to get serializer from. |
TKey | key | Key to get the serializer for. |
Returns
Type | Description |
---|---|
TSerializer | Found serializer; if not found, then fallback serializer |
Type Parameters
Name | Description |
---|---|
TKey | Type of the serializer key. |
TSerializer | Type of the serializer. |
TryFindSerializer<TKey, TSerializer>(ISerializerProvider<TKey, TSerializer>, TKey, out TSerializer)
Gets serializer mapped to the key.
Declaration
public static bool TryFindSerializer<TKey, TSerializer>(this ISerializerProvider<TKey, TSerializer> provider, TKey key, out TSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
ISerializerProvider<TKey, TSerializer> | provider | Provider to get serializer from. |
TKey | key | Key to get the serializer for. |
TSerializer | serializer | Found serializer. |
Returns
Type | Description |
---|---|
Boolean | True if non-fallback serializer was found; otherwise false. |
Type Parameters
Name | Description |
---|---|
TKey | Type of the serializer key. |
TSerializer | Type of the serializer. |