1

I have query to perform where the user will enter at runtime one of the columns to be included in the result set. And, I won't know until runtime how many columns he could choose from (he uploads a file that can contain a varying number of columns). I'd like to write the query where the index of the column is dynamic. What's the best way to do this kind of query?

Thanks.

4

1 回答 1

3

You're looking for Dynamic LINQ.

Alternatively, you could generate expression trees from the column names and call ThenBy in a loop.

于 2010-11-25T03:23:49.110 回答