Table of Contents

Class ComplexObjectValueTypeSerializer.NullIgnoringListSerializer<T>

Namespace
adas_core.Domain.Utils
Assembly
adas-core.Domain.dll

Provides serialization for List<T> instances while ignoring null elements.

public class ComplexObjectValueTypeSerializer.NullIgnoringListSerializer<T> : SerializerBase<List<T>>, IBsonSerializer<List<T>>, IBsonSerializer

Type Parameters

T

The 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

context BsonDeserializationContext

The BSON deserialization context providing the reader used to read the BSON data.

args BsonDeserializationArgs

Additional arguments that influence the deserialization process.

Returns

List<T>

A List<T> containing the deserialized elements, or an empty list if the BSON value is null.

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

context BsonSerializationContext

The BSON serialization context providing the writer used to emit the array and its elements.

args BsonSerializationArgs

The BSON serialization arguments supplying additional options for the serialization process.

value List<T>

The list of items to serialize as a BSON array.