Esempio n. 1
0
        public static string SerializeToString <T>(T value)
        {
            if (value == null)
            {
                return(null);
            }
            if (typeof(T) == typeof(string))
            {
                return(value as string);
            }

            var sb = new StringBuilder();

            using (var writer = new StringWriter(sb, CultureInfo.InvariantCulture))
            {
                CsvSerializer <T> .WriteObject(writer, value);
            }
            return(sb.ToString());
        }
Esempio n. 2
0
 public static string ToCsv <T>(this T obj)
 {
     return(CsvSerializer.SerializeToString(obj));
 }