Class ComplexObjectValueTypeSerializer.NullIgnoringListSerializer<T>
Provides serialization for List<T> instances while ignoring null elements.
public class ComplexObjectValueTypeSerializer.NullIgnoringListSerializer<T> : SerializerBase<List<T>>, IBsonSerializer<List<T>>, IBsonSerializer
Type Parameters
TThe type of elements contained in the list being serialized.
- Inheritance
-
SerializerBase<List<T>>ComplexObjectValueTypeSerializer.NullIgnoringListSerializer<T>
- Implements
-
IBsonSerializer<List<T>>IBsonSerializer
- Inherited Members
-
SerializerBase<List<T>>.GetHashCode()SerializerBase<List<T>>.CreateCannotBeDeserializedException()SerializerBase<List<T>>.CreateCannotBeSerializedException()SerializerBase<List<T>>.CreateCannotDeserializeFromBsonTypeException(BsonType)SerializerBase<List<T>>.EnsureBsonTypeEquals(IBsonReader, BsonType)SerializerBase<List<T>>.ValueType
- Extension Methods
Methods
Deserialize(BsonDeserializationContext, BsonDeserializationArgs)
Deserializes a BSON array into a List<T>, returning an empty list when the current BSON value is null and skipping any null elements encountered while reading the array.
public override List<T> Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
Parameters
contextBsonDeserializationContextThe BSON deserialization context providing the reader used to read the BSON data.
argsBsonDeserializationArgsAdditional arguments that influence the deserialization process.
Returns
Serialize(BsonSerializationContext, BsonSerializationArgs, List<T>)
Serializes a List<T> as a BSON array, writing each element using its actual runtime type to support polymorphic serialization. Null elements are handled safely through the null-conditional type resolution.
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, List<T> value)
Parameters
contextBsonSerializationContextThe BSON serialization context providing the writer used to emit the array and its elements.
argsBsonSerializationArgsThe BSON serialization arguments supplying additional options for the serialization process.
valueList<T>The list of items to serialize as a BSON array.