Class DowncastingSerializer<TBase, TDerived>
- Namespace
 - MongoDB.Bson.Serialization.Serializers
 
- Assembly
 - MongoDB.Bson.dll
 
A serializer for TBase where the actual values are of type TDerived.
public sealed class DowncastingSerializer<TBase, TDerived> : SerializerBase<TBase>, IBsonSerializer<TBase>, IBsonArraySerializer, IBsonDocumentSerializer, IBsonSerializer, IDowncastingSerializer where TDerived : TBase
  Type Parameters
TBaseThe base type.
TDerivedThe derived type.
- Inheritance
 - 
      
      SerializerBase<TBase>DowncastingSerializer<TBase, TDerived>
 
- Implements
 - 
      IBsonSerializer<TBase>
 
- Inherited Members
 
- Extension Methods
 
Constructors
- DowncastingSerializer(IBsonSerializer<TDerived>)
 Initializes a new instance of DowncastingSerializer.
Properties
- BaseType
 The base type that the serializer will downcast from.
- DerivedSerializer
 The serializer for the derived type.
- DerivedType
 The derived type that the serializer will downcast to.
Methods
- Deserialize(BsonDeserializationContext, BsonDeserializationArgs)
 Deserializes a value.
- Equals(object)
 Determines whether the specified object is equal to the current object.
- GetHashCode()
 Serves as the default hash function.
- Serialize(BsonSerializationContext, BsonSerializationArgs, TBase)
 Serializes a value.
- TryGetItemSerializationInfo(out BsonSerializationInfo)
 Tries to get the serialization info for the individual items of the array.
- TryGetMemberSerializationInfo(string, out BsonSerializationInfo)
 Tries to get the serialization info for a member.