I am using the below query to find the distinct rows from a dataset but its not getting me the distinct for example its not removing the duplicate and show me the distinct count.
var distinctRows 开发者_Go百科= (from DataRow dRow in _dsMechanic.Tables[0].Rows
select new { col1 = dRow["colName"] }).Distinct();
This should work:
var distinctRows = (
from DataRow dRow in _dsMechanic.Tables[0].Rows
select dRow["colName"]).
Distinct();
Doing the distinct on an anonymous type is just asking for trouble.
精彩评论