Esempio n. 1
0
 public static void SerializeToWriter <T>(T value, TextWriter writer)
 {
     if (value == null)
     {
         return;
     }
     if (typeof(T) == typeof(string))
     {
         writer.Write(value);
         return;
     }
     CsvSerializer <T> .WriteObject(writer, value);
 }
Esempio n. 2
0
        public static string SerializeToString <T>(T value)
        {
            if (value == null)
            {
                return(null);
            }
            if (typeof(T) == typeof(string))
            {
                return(value as string);
            }

            var writer = StringWriterThreadStatic.Allocate();

            CsvSerializer <T> .WriteObject(writer, value);

            return(StringWriterThreadStatic.ReturnAndFree(writer));
        }
Esempio n. 3
0
        public static void InitAot <T>()
        {
            CsvSerializer <T> .WriteFn();

            CsvSerializer <T> .WriteObject(null, null);

            CsvWriter <T> .Write(null, default(IEnumerable <T>));

            CsvWriter <T> .WriteRow(null, default(T));

            CsvWriter <T> .WriteObject(null, default(IEnumerable <T>));

            CsvWriter <T> .WriteObjectRow(null, default(IEnumerable <T>));

            CsvReader <T> .ReadRow(null);

            CsvReader <T> .ReadObject(null);

            CsvReader <T> .ReadObjectRow(null);

            CsvReader <T> .ReadStringDictionary(null);
        }