MongoDB.Bson.Serialization.Serializers.ImageSerializer.Deserialize C# (CSharp) Метод

Deserialize() публичный Метод

Deserializes an Image from a BsonReader.
public Deserialize ( MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options ) : object
bsonReader MongoDB.Bson.IO.BsonReader The BsonReader.
nominalType System.Type The nominal type of the Image.
options IBsonSerializationOptions The serialization options.
Результат object
        public override object Deserialize(
            BsonReader bsonReader,
            Type nominalType,
            IBsonSerializationOptions options)
        {
            if (nominalType != typeof(Image))
            {
                var message = string.Format("Nominal type must be Image, not {0}.", nominalType.FullName);
                throw new ArgumentException(message, "nominalType");
            }

            var discriminatorConvention = BsonSerializer.LookupDiscriminatorConvention(typeof(Image));
            var actualType = discriminatorConvention.GetActualType(bsonReader, typeof(Image));
            if (actualType == typeof(Image))
            {
                var message = string.Format("Unable to determine actual type of Image to deserialize.");
                throw new FileFormatException(message);
            }

            var serializer = BsonSerializer.LookupSerializer(actualType);
            return serializer.Deserialize(bsonReader, nominalType, actualType, options);
        }

Same methods

ImageSerializer::Deserialize ( MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options ) : object