Method MapToBsonValue
MapToBsonValue(object)
Maps an object to an instance of the closest BsonValue class.
public static BsonValue MapToBsonValue(object value)
Parameters
value
objectAn object.
Returns
- BsonValue
A BsonValue.
MapToBsonValue(object, BsonType)
Maps an object to a specific BsonValue type.
public static BsonValue MapToBsonValue(object value, BsonType bsonType)
Parameters
Returns
- BsonValue
A BsonValue of the desired type (or BsonNull.Value if value is null and bsonType is Null).