How to refer to a LINQ field with a variable?
Posted on 2008-10-15
I've a LINQ query working fine, then if I want to refer to a returned field from that query in LINQ I use something like:
And that also works fine.
Now: what I need is a method where I can use:
Imagine I want to implement the following:
string GetFieldValue(string MyFieldName)
return MyLINQQuery.MyFieldName.ToString(); //where MyLINQQuery is a public LINQ query object and MyFieldName will be a variable specified in the method.
How can I do this?