MongoDB.Bson.Serialization.Serializers.ImageSerializer.Serialize C# (CSharp) 메소드

Serialize() 공개 메소드

Serializes an Image to a BsonWriter.
public Serialize ( BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options ) : void
bsonWriter MongoDB.Bson.IO.BsonWriter The BsonWriter.
nominalType System.Type The nominal type.
value object The Image.
options IBsonSerializationOptions The serialization options.
리턴 void
        public override void Serialize(
            BsonWriter bsonWriter,
            Type nominalType,
            object value,
            IBsonSerializationOptions options)
        {
            if (nominalType != typeof(Image))
            {
                var message = string.Format("Nominal type must be Image, not {0}.", nominalType.FullName);
                throw new ArgumentException(message, "nominalType");
            }

            if (value == null)
            {
                bsonWriter.WriteNull();
            }
            else
            {
                var message = string.Format("Value must be null.");
                throw new ArgumentException(message, "value");
            }
        }
    }