public static int GetColumnNumber(this DataTableCollection tables, int tableNumber, string columnName)
        {
            var column = tables
                         .GetColumns(tableNumber)
                         .FirstOrDefault(x => x.Caption.ToLower() == columnName.ToLower());

            if (column == null)
            {
                return(-1);
            }

            return(column.Ordinal);
        }
 public static IEnumerable <string> GetColumnsNames(this DataTableCollection tables, int tableNumber) =>
 tables
 .GetColumns(tableNumber)
 .Select(x => x.Caption)
 .ToList();