public override object Deserialize(
BsonReader bsonReader,
Type nominalType,
Type actualType,
IBsonSerializationOptions options)
{
VerifyTypes(nominalType, actualType, typeof(char));
BsonType bsonType = bsonReader.GetCurrentBsonType();
switch (bsonType)
{
case BsonType.Int32:
return (char)bsonReader.ReadInt32();
case BsonType.String:
return (char)bsonReader.ReadString()[0];
default:
var message = string.Format("Cannot deserialize Char from BsonType {0}.", bsonType);
throw new Exception(message);
}
}