public static BsonValue MapToBsonValue( object value // will be mapped to an instance of the closest BsonValue class ) { BsonValue bsonValue; if (TryMapToBsonValue(value, out bsonValue)) { return bsonValue; } var message = string.Format(".NET type {0} cannot be mapped to a BsonValue.", value.GetType().FullName); throw new ArgumentException(message); }
/// <summary> /// Creates a new BsonArray. /// </summary> /// <param name="value">A value to be mapped to a BsonArray.</param> /// <returns>A BsonArray or null.</returns> public new static BsonArray Create(object value) { if (value != null) { return((BsonArray)BsonTypeMapper.MapToBsonValue(value, BsonType.Array)); } else { return(null); } }