Exemplo n.º 1
0
            /// <summary>
            /// Adds a serializer for a custom type.
            /// </summary>
            /// <param name="type">The custom type supported by the serializer.</param>
            /// <param name="serializer">The serializer for the custom type.</param>
            public Builder AddCustomType(Type type, CustomTypeSerializer serializer)
            {
                if (serializer == null)
                {
                    throw new ArgumentNullException(nameof(serializer));
                }
                if (serializer.TypeName == null)
                {
                    throw new ArgumentException("serializer custom type name can not be null");
                }

                _list.Add(new CustomTypeRegistryEntry(type, serializer));
                return(this);
            }
 /// <summary>
 ///     Adds a serializer for a custom type.
 /// </summary>
 /// <param name="type">The custom type supported by the serializer.</param>
 /// <param name="serializer">The serializer for the custom type.</param>
 public Builder AddCustomType(Type type, CustomTypeSerializer serializer)
 {
     _builder.AddCustomType(type, serializer);
     return(this);
 }
Exemplo n.º 3
0
 public CustomTypeRegistryEntry(Type type, CustomTypeSerializer typeSerializer)
 {
     Type           = type;
     TypeSerializer = typeSerializer;
 }