Ejemplo n.º 1
0
        protected override bool TryRead(CsvReader reader, CsvSerializerContext serializer, CsvHeaderNamingContext naming, ref SingleIntValue result)
        {
            int value;

            if (reader.TryGetField <int>(naming.GetDefault(nameof(SingleIntValue.Value)), out value))
            {
                result = new SingleIntValue()
                {
                    Value = value
                };
                return(true);
            }

            return(false);
        }
        protected override bool TryRead(CsvReader reader, CsvSerializerContext serializer, CsvHeaderNamingContext naming, ref SingleStringValue result)
        {
            string value;

            if (reader.TryGetField <string>(naming.GetDefault("Value"), out value))
            {
                result = new SingleStringValue()
                {
                    Value = value
                };

                return(true);
            }

            return(false);
        }
 protected override void WriteHeader(CsvWriter writer, CsvSerializerContext serializer, CsvHeaderNamingContext naming)
 {
     writer.WriteField(naming.GetDefault("Value"));
 }
Ejemplo n.º 4
0
 protected override void WriteHeader(CsvWriter writer, CsvSerializerContext serializer, CsvHeaderNamingContext naming)
 {
     writer.WriteField(naming.GetDefault(nameof(SingleNullableIntValue.Value)));
 }