Table of Contents

Class ExpandoObjectSerializer

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

Serializer for ExpandoObject.

public class ExpandoObjectSerializer : DynamicDocumentBaseSerializer<ExpandoObject>, IBsonSerializer<ExpandoObject>, IBsonSerializer
Inheritance
ExpandoObjectSerializer
Implements
Inherited Members
Extension Methods

Remarks

The use of ExpandoObject will serialize any List<T> without type information. To get the best experience out of using an ExpandoObject, any member wanting to be used as an array should use List<T>.

Constructors

ExpandoObjectSerializer()

Initializes a new instance of the ExpandoObjectSerializer class.

public ExpandoObjectSerializer()

Methods

ConfigureDeserializationContext(Builder)

Configures the deserialization context.

protected override void ConfigureDeserializationContext(BsonDeserializationContext.Builder builder)

Parameters

builder BsonDeserializationContext.Builder

The builder.

ConfigureSerializationContext(Builder)

Configures the serialization context.

protected override void ConfigureSerializationContext(BsonSerializationContext.Builder builder)

Parameters

builder BsonSerializationContext.Builder

The builder.

CreateDocument()

Creates the document.

protected override ExpandoObject CreateDocument()

Returns

ExpandoObject

A ExpandoObject.

SetValueForMember(ExpandoObject, string, object)

Sets the value for the member.

protected override void SetValueForMember(ExpandoObject document, string memberName, object value)

Parameters

document ExpandoObject

The document.

memberName string

Name of the member.

value object

The value.

TryGetValueForMember(ExpandoObject, string, out object)

Tries to get the value for a member. Returns true if the member should be serialized.

protected override bool TryGetValueForMember(ExpandoObject value, string memberName, out object memberValue)

Parameters

value ExpandoObject

The value.

memberName string

Name of the member.

memberValue object

The member value.

Returns

bool

true if the member should be serialized; otherwise false.