Class BsonSerializationInfo
- Namespace
- MongoDB.Bson.Serialization
- Assembly
- MongoDB.Bson.dll
Represents the information needed to serialize a member.
public class BsonSerializationInfo
- Inheritance
-
BsonSerializationInfo
- Inherited Members
- Extension Methods
Constructors
BsonSerializationInfo(string, IBsonSerializer, Type)
Initializes a new instance of the BsonSerializationInfo class.
public BsonSerializationInfo(string elementName, IBsonSerializer serializer, Type nominalType)
Parameters
elementName
stringThe element name.
serializer
IBsonSerializerThe serializer.
nominalType
TypeThe nominal type.
Properties
ElementName
Gets the element name.
public string ElementName { get; }
Property Value
ElementPath
Gets element path.
public IReadOnlyList<string> ElementPath { get; }
Property Value
NominalType
Gets or sets the nominal type.
public Type NominalType { get; }
Property Value
Serializer
Gets or sets the serializer.
public IBsonSerializer Serializer { get; }
Property Value
Methods
CreateWithPath(IEnumerable<string>, IBsonSerializer, Type)
Creates a new instance of the BsonSerializationinfo class with an element path instead of an element name.
public static BsonSerializationInfo CreateWithPath(IEnumerable<string> elementPath, IBsonSerializer serializer, Type nominalType)
Parameters
elementPath
IEnumerable<string>The element path.
serializer
IBsonSerializerThe serializer.
nominalType
TypeThe nominal type.
Returns
- BsonSerializationInfo
A BsonSerializationInfo.
DeserializeValue(BsonValue)
Deserializes the value.
public object DeserializeValue(BsonValue value)
Parameters
value
BsonValueThe value.
Returns
- object
A deserialized value.
Merge(BsonSerializationInfo)
Merges the new BsonSerializationInfo by taking its properties and concatenating its ElementName.
[Obsolete("This method is no longer relevant because field names are now allowed to contain dots.")]
public BsonSerializationInfo Merge(BsonSerializationInfo newSerializationInfo)
Parameters
newSerializationInfo
BsonSerializationInfoThe new info.
Returns
- BsonSerializationInfo
A new BsonSerializationInfo.
SerializeValue(object)
Serializes the value.
public BsonValue SerializeValue(object value)
Parameters
value
objectThe value.
Returns
- BsonValue
The serialized value.
SerializeValues(IEnumerable)
Serializes the values.
public BsonArray SerializeValues(IEnumerable values)
Parameters
values
IEnumerableThe values.
Returns
- BsonArray
The serialized values.
WithNewName(string)
Creates a new BsonSerializationInfo object using the elementName provided and copying all other attributes.
public BsonSerializationInfo WithNewName(string elementName)
Parameters
elementName
stringName of the element.
Returns
- BsonSerializationInfo
A new BsonSerializationInfo.