Table of Contents

Class SerializerBase<TValue>

Namespace
MongoDB.Bson.Serialization.Serializers
Assembly
MongoDB.Bson.dll

Represents an abstract base class for serializers.

public abstract class SerializerBase<TValue> : IBsonSerializer<TValue>, IBsonSerializer

Type Parameters

TValue

The type of the value.

Inheritance
SerializerBase<TValue>
Implements
Derived
Inherited Members
Extension Methods

Properties

ValueType

Gets the type of the values.

public Type ValueType { get; }

Property Value

Type

The type of the values.

Methods

CreateCannotBeDeserializedException()

Creates an exception to throw when a type cannot be deserialized.

protected Exception CreateCannotBeDeserializedException()

Returns

Exception

An exception.

CreateCannotBeSerializedException()

Creates an exception to throw when a type cannot be deserialized.

protected Exception CreateCannotBeSerializedException()

Returns

Exception

An exception.

CreateCannotDeserializeFromBsonTypeException(BsonType)

Creates an exception to throw when a type cannot be deserialized from a BsonType.

protected Exception CreateCannotDeserializeFromBsonTypeException(BsonType bsonType)

Parameters

bsonType BsonType

The BSON type.

Returns

Exception

An exception.

Deserialize(BsonDeserializationContext, BsonDeserializationArgs)

Deserializes a value.

public virtual TValue Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)

Parameters

context BsonDeserializationContext

The deserialization context.

args BsonDeserializationArgs

The deserialization args.

Returns

TValue

A deserialized value.

EnsureBsonTypeEquals(IBsonReader, BsonType)

Ensures that the BsonType equals the expected type.

protected void EnsureBsonTypeEquals(IBsonReader reader, BsonType bsonType)

Parameters

reader IBsonReader

The reader.

bsonType BsonType

The expected type.

Serialize(BsonSerializationContext, BsonSerializationArgs, TValue)

Serializes a value.

public virtual void Serialize(BsonSerializationContext context, BsonSerializationArgs args, TValue value)

Parameters

context BsonSerializationContext

The serialization context.

args BsonSerializationArgs

The serialization args.

value TValue

The value.