如果使用DataTableExtensions.AsEnumerable()方法,则可以使用LINQ查询您的DataTable。然后,您可以
List<T>.FindIndex用来确定给定谓词的索引:
int? index = new System.Data.DataView(dt).ToTable(false, new[] { "1" }) .AsEnumerable() .Select(row => row.Field<string>("1")) // ie. project the col(s) needed .ToList() .FindIndex(col => col == "G"); // returns 2


