/// <inheritdoc/> public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, ICurrency value) { if (value is null) { context.Writer.WriteNull(); return; } if (!_currencySet.Contain(value)) { throw new NotSupportedException("currency code '" + value.CharCode + "' not supported"); } context.Writer.WriteString(value.CharCode); }