Exemplo n.º 1
0
        /// <summary>
        /// <see cref="ReverseByteOrderBobKeySerializer{TKey}"/> constructor
        /// </summary>
        /// <param name="innerSerializer">Inner serializer</param>
        public ReverseByteOrderBobKeySerializer(BobKeySerializer <TKey> innerSerializer)
        {
            if (innerSerializer == null)
            {
                throw new ArgumentNullException(nameof(innerSerializer));
            }

            _innerSerializer = innerSerializer;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Attempts to get default <see cref="BobKeySerializer{TKey}"/> for a key of type <typeparamref name="TKey"/>
 /// </summary>
 /// <typeparam name="TKey">Type of the key</typeparam>
 /// <param name="serializer">Extracted serializer (null if not found)</param>
 /// <returns>true if the <see cref="BobDefaultKeySerializers"/> contains serializer for key of type <typeparamref name="TKey"/></returns>
 public static bool TryGetKeySerializer <TKey>(out BobKeySerializer <TKey> serializer)
 {
     if (_serializers.TryGetValue(typeof(TKey), out object val))
     {
         serializer = (BobKeySerializer <TKey>)val;
         return(true);
     }
     else
     {
         serializer = null;
         return(false);
     }
 }