Bob
2008-08-01 13:18:37
views:
2453answers:
4
A:
try the following
var names = (from dr in dataTable.Rows
select (string)dr["Name"]).Distinct().OrderBy(name => name);
this should work for what you need
Nick Berardi
2008-08-07 02:35:28
+1
A:
To make it more readable and maintainable, you can also split it up into multiple LINQ statements.
- First, select your data into a new list, let's call it x1, do a projection if desired
- Next, create a distinct list, from x1 into x2, using whatever distinction you require
- Finally, create an ordered list, from x2 into x3, sorting by whatever you desire
AndrewDotHay
2008-09-04 02:57:27