I have a requirement to extract a distinct subset of rows from a DataTable, and thought LINQ2DataSets may be a useful and clean way to do this, however it appears that it is not possible to simply identify return rows from a LINQ2DS query as follows
var result = from r in fips.AsEnumerable() select r.Field<string>('FACILITY_PROCESS_SUB_GROUP_CODE'), r.Field<string>('PROCESS_SUB_GROUP_NAME'), r.Field<string>('...
as I start getting errors after the first comma.
Is this a correct assumption, and how would I get around it to return a subset of columns from the dataset that I can apply a Distinct() method to?
You forgot the new statement and field names:
You can also explicitly declare that you are going to use a type:
Scott Guthrie (VP Developer Devision, Microsoft) has some good info about LINQ (he talks about LINQ to SQL, but most of it applies regardless).
Then apply the distinct clause:
Then put it to a list or iterate over it. Nothing will be selected/distincted/etc until something like on of the following is run: