コード例 #1
0
            public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
            {
                var values = _fromCase(value);

                if (_isSingleValue)
                {
                    JsonSerializer.Serialize(writer, values[0], _props[0].PropertyType, options);
                }
                else if (_isTupleValue)
                {
                    var tuple = _toTuple(values);
                    JsonSerializer.Serialize(writer, tuple, _tupleType, options);
                }
                else
                {
                    writer.WriteFields(_props, values, options);
                }
            }
コード例 #2
0
            public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
            {
                var values = _fromRecord(value);

                writer.WriteFields(_props, values, options);
            }