//public static IEnumerable<string[,]> GetDataTables(params IEnumerable[] collections) //{ // if (collections == null) return null; // List<string[,]> array = new List<string[,]>(); // foreach (IEnumerable collection in collections) // array.Add(GetDataTable(collection)); // return array; //} public static string[,] GetDataTable <T>(IEnumerable <T> collection) { if (collection == null || !collection.Any()) { return(new string[0, 0]); } var first = collection.First(); return (first is Meter ? Meter.GetDataTableOfMeters(collection.Cast <Meter>()) : first is Document ? Document.GetDataTableOfDocuments(collection.Cast <Document>()) : first is Parametr ? Parametr.GetDataTableOfParametrs(collection.Cast <Parametr>()) : first is Reading ? Reading.GetDataTableOfReadings(collection.Cast <Reading>()) : first is Tariff ? Tariff.GetDataTableOfTariffs(collection.Cast <Tariff>()) : first is TimeSpan ? TimeSpan.GetDataTableOfTimeSpans(collection.Cast <TimeSpan>()) : first is Type ? Type.GetDataTableOfTypes(collection.Cast <Type>()) : first is User ? User.GetDataTableOfUsers(collection.Cast <User>()) : new string[0, 0]); }