Пример #1
0
 public static List <string> CsvAsList(this IDataTableObject _, string csvString)
 {
     if (string.IsNullOrEmpty(csvString))
     {
         return(new List <string>());
     }
     return(csvString.Split(',').ToList());
 }
Пример #2
0
        public static bool AsBoolean(this IDataTableObject _, object data)
        {
            if (bool.TryParse((string)data, out bool result))
            {
                return(result);
            }

            return(default(bool));
        }
Пример #3
0
 public static long AsEpoch(this IDataTableObject _, DateTime dateTime)
 {
     return((long)dateTime.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds);
 }
Пример #4
0
 public static DateTime AsDateTime(this IDataTableObject _, long epochTime)
 {
     return(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(epochTime));
 }