/// <summary> /// Serializes an object to a BsonWriter. /// </summary> /// <param name="bsonWriter">The BsonWriter.</param> /// <param name="nominalType">The nominal type.</param> /// <param name="value">The object.</param> /// <param name="options">The serialization options.</param> public override void Serialize( BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options ) { if (value == null) { bsonWriter.WriteNull(); } else { var timestamp = (BsonTimestamp) value; bsonWriter.WriteTimestamp(timestamp.Value); } }
/// <summary> /// Serializes an object to a BsonWriter. /// </summary> /// <param name="bsonWriter">The BsonWriter.</param> /// <param name="nominalType">The nominal type.</param> /// <param name="value">The object.</param> /// <param name="options">The serialization options.</param> public override void Serialize( BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options) { if (value == null) { throw new ArgumentNullException("value"); } var timestamp = (BsonTimestamp)value; bsonWriter.WriteTimestamp(timestamp.Value); }
public override void Serialize( BsonWriter bsonWriter, Type nominalType, object value, bool serializeIdFirst ) { if (value == null) { bsonWriter.WriteNull(); } else { bsonWriter.WriteTimestamp(((BsonTimestamp) value).Value); } }