/// <summary> /// Retrieve the list of expanded columns. If there is a one-to-one correspondence between the /// type and its expansion it will return a single value/. /// </summary> /// <param name="features">Features</param> /// <returns></returns> public static IEnumerable <string> GetColumns(DateTimeFeature features) { Func <DateTimeFeature, string> c = d => Enum.GetName(typeof(DateTimeFeature), d); if (features.HasFlag(DateTimeFeature.Year)) { yield return(c(DateTimeFeature.Year)); } if (features.HasFlag(DateTimeFeature.DayOfYear)) { yield return("DayOfYear"); } if (features.HasFlag(DateTimeFeature.Month)) { yield return("Month"); } if (features.HasFlag(DateTimeFeature.Day)) { yield return("Day"); } if (features.HasFlag(DateTimeFeature.DayOfWeek)) { yield return("DayOfWeek"); } if (features.HasFlag(DateTimeFeature.Hour)) { yield return("Hour"); } if (features.HasFlag(DateTimeFeature.Minute)) { yield return("Minute"); } if (features.HasFlag(DateTimeFeature.Second)) { yield return("Second"); } if (features.HasFlag(DateTimeFeature.Millisecond)) { yield return("Millisecond"); } }
/// <summary> /// Retrieve the list of expanded columns. If there is a one-to-one correspondence between the /// type and its expansion it will return a single value/. /// </summary> /// <param name="features">Features</param> /// <returns></returns> public static IEnumerable <string> GetColumns(DateTimeFeature features) { if (features.HasFlag(DateTimeFeature.Year)) { yield return(nameof(DateTimeFeature.Year)); } if (features.HasFlag(DateTimeFeature.DayOfYear)) { yield return(nameof(DateTimeFeature.DayOfYear)); } if (features.HasFlag(DateTimeFeature.Month)) { yield return(nameof(DateTimeFeature.Month)); } if (features.HasFlag(DateTimeFeature.Day)) { yield return(nameof(DateTimeFeature.Day)); } if (features.HasFlag(DateTimeFeature.DayOfWeek)) { yield return(nameof(DateTimeFeature.DayOfWeek)); } if (features.HasFlag(DateTimeFeature.Hour)) { yield return(nameof(DateTimeFeature.Hour)); } if (features.HasFlag(DateTimeFeature.Minute)) { yield return(nameof(DateTimeFeature.Minute)); } if (features.HasFlag(DateTimeFeature.Second)) { yield return(nameof(DateTimeFeature.Second)); } if (features.HasFlag(DateTimeFeature.Millisecond)) { yield return(nameof(DateTimeFeature.Millisecond)); } }
/// <summary> /// Retrieve the list of expanded columns. If there is a one-to-one correspondence between the /// type and its expansion it will return a single value/. /// </summary> /// <param name="features">Features</param> /// <returns></returns> public static IEnumerable<string> GetColumns(DateTimeFeature features) { Func<DateTimeFeature, string> c = d => Enum.GetName(typeof(DateTimeFeature), d); if (features.HasFlag(DateTimeFeature.Year)) yield return c(DateTimeFeature.Year); if (features.HasFlag(DateTimeFeature.DayOfYear)) yield return "DayOfYear"; if (features.HasFlag(DateTimeFeature.Month)) yield return "Month"; if (features.HasFlag(DateTimeFeature.Day)) yield return "Day"; if (features.HasFlag(DateTimeFeature.DayOfWeek)) yield return "DayOfWeek"; if (features.HasFlag(DateTimeFeature.Hour)) yield return "Hour"; if (features.HasFlag(DateTimeFeature.Minute)) yield return "Minute"; if (features.HasFlag(DateTimeFeature.Second)) yield return "Second"; if (features.HasFlag(DateTimeFeature.Millisecond)) yield return "Millisecond"; }