>>>>I can not convert row into DataRow, therefore I don't see a way to access each individual column of that resulting query. David's class solves this problem, but if I can create a simpler code, I'd love to.
>>>
>>>
>>>I haven't tried with anonymous types, I mostly use concrete classes to select into. But through reflection you can enumerate the fields & properties in the object and then create the Data table based on these..... If the extension method works for you and creates what you need, this will probably be the simplest solution going forward...
>>
>>Yes, that class does work.
>>
>>But I found (actually, David replied in my e-mail) that I can use properties of this anonymous type.
>>
>>So, looks like I can simply use code like this
>>
>>
>>foreach (var row in resultingQuery)
>> {
>> DataRow newRow = dtReturn.NewRow();
>>
>> newRow["resource1"] = row.resource1;
>> newRow["fname"] = row.fname;
>>
>> dtReturn.Rows.Add(newRow);
>> }
>>
>>
>>Wondering if this is easier than David's class or not.
>
>For me, I would roll my own as you have demonstrated. But I would implement it as an extension method.
I like this reply!