I have a data table and I want to perform a case insensitive group by over a column of data table (say Column1 of type string). I observed that normally LINQ to DataSet perform case sensitive comparison. For example if Column1 is having two values say Test and test, after applying group by it returns two seperate rows with values Test and test. The query is as follows:
var countGroupQuery = from table in dataTable.AsEnumerable()
group table by table.Field<string>(Column1) into groupedTable
select new
{
value = groupedTable.Key,
count = groupedTable.Count()
};
so, is there any method exist to perform case in-sensitive group by so that in above example I get only one row with one value either Test or test? Also I dont want to use ToUpper or ToLower methods because it actually changes the values to either upper case or lower case.
group table by table.Field<string>(Column1).ToUpper() into groupedTable
Thanks,