In my program I have a dataTable and I´d like to know if is there a column which name starts with abc.
For example I have a DataTable and its name is abcdef
. I like to find this column using something like this:
DataTable.Columns.Constains(ColumnName.StartWith(abc))
Because I know only part of the column name, I cannot use a Contains method. Is there any simple way how to do that?
Thanks a lot.
You can use this:
var datatable = new DataTable();
var abccolumns = datatable.Columns.Cast<DataColumn>()
.Where(c => c.ColumnName.StartsWith("abc"));