Class DateTimeSerializer
- Namespace
- MongoDB.Bson.Serialization.Serializers
- Assembly
- MongoDB.Bson.dll
Represents a serializer for DateTimes.
public class DateTimeSerializer : StructSerializerBase<DateTime>, IBsonSerializer<DateTime>, IBsonSerializer, IRepresentationConfigurable<DateTimeSerializer>, IRepresentationConfigurable, IHasRepresentationSerializer
- Inheritance
-
DateTimeSerializer
- Implements
- Inherited Members
- Extension Methods
Constructors
- DateTimeSerializer()
Initializes a new instance of the DateTimeSerializer class.
- DateTimeSerializer(BsonType)
Initializes a new instance of the DateTimeSerializer class.
- DateTimeSerializer(bool)
Initializes a new instance of the DateTimeSerializer class.
- DateTimeSerializer(bool, BsonType)
Initializes a new instance of the DateTimeSerializer class.
- DateTimeSerializer(DateTimeKind)
Initializes a new instance of the DateTimeSerializer class.
- DateTimeSerializer(DateTimeKind, BsonType)
Initializes a new instance of the DateTimeSerializer class.
Properties
- DateOnly
Gets whether this DateTime consists of a Date only.
- DateOnlyInstance
Gets an instance of DateTimeSerializer with DateOnly=true.
- Instance
Gets the default DateTimeSerializer.
- Kind
Gets the DateTimeKind (Local, Unspecified or Utc).
- LocalInstance
Gets an instance of DateTimeSerializer with Kind=Local.
- Representation
Gets the external representation.
- UtcInstance
Gets an instance of DateTimeSerializer with Kind=Utc.
Methods
- Deserialize(BsonDeserializationContext, BsonDeserializationArgs)
Deserializes a value.
- Serialize(BsonSerializationContext, BsonSerializationArgs, DateTime)
Serializes a value.
- WithDateOnly(bool)
Returns a serializer that has been reconfigured with the specified dateOnly value.
- WithDateOnly(bool, BsonType)
Returns a serializer that has been reconfigured with the specified dateOnly value and representation.
- WithKind(DateTimeKind)
Returns a serializer that has been reconfigured with the specified DateTimeKind value.
- WithKind(DateTimeKind, BsonType)
Returns a serializer that has been reconfigured with the specified DateTimeKind value and representation.
- WithRepresentation(BsonType)
Returns a serializer that has been reconfigured with the specified representation.