public static ColumnData.ColumnDataInfo[] ToColumnDataInfo <T>(Boolean sortByName) { Type enumType = typeof(T); if (!enumType.IsEnum) { throw new InvalidOperationException("This type is not an enumeration"); } String[] enumNames = Enum.GetNames(enumType); if (sortByName) { Array.Sort(enumNames); } List <ColumnData.ColumnDataInfo> listColumnDataInfo = new List <ColumnData.ColumnDataInfo>(); Enum enumValue; ColumnData.ColumnDataInfo columnDataInfo; foreach (String enumName in enumNames) { enumValue = (Enum)Enum.Parse(enumType, enumName); { columnDataInfo = new ColumnData.ColumnDataInfo(); columnDataInfo.DataType = ColumnData.GetDataType(enumValue); columnDataInfo.TypeIsString = ColumnData.IsDataTypeString(enumValue); columnDataInfo.Name = ColumnData.GetName(enumValue); listColumnDataInfo.Add(columnDataInfo); } } return(listColumnDataInfo.ToArray()); }