Table of Contents

Class BsonDefaultValueAttribute

Namespace
MongoDB.Bson.Serialization.Attributes
Assembly
MongoDB.Bson.dll

Specifies the default value for a field or property.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public class BsonDefaultValueAttribute : Attribute, IBsonMemberMapAttribute
Inheritance
BsonDefaultValueAttribute
Implements
Inherited Members
Extension Methods

Constructors

BsonDefaultValueAttribute(object)

Initializes a new instance of the BsonDefaultValueAttribute class.

public BsonDefaultValueAttribute(object defaultValue)

Parameters

defaultValue object

The default value.

Properties

DefaultValue

Gets the default value.

public object DefaultValue { get; }

Property Value

object

SerializeDefaultValue

Gets or sets whether to serialize the default value.

[Obsolete("Use BsonIgnoreIfDefaultAttribute instead.")]
public bool SerializeDefaultValue { get; set; }

Property Value

bool

Methods

Apply(BsonMemberMap)

Applies a modification to the member map.

public void Apply(BsonMemberMap memberMap)

Parameters

memberMap BsonMemberMap

The member map.