How do I reference a field in Linq based on a dynamic fieldname

后端 未结 5 1326
予麋鹿
予麋鹿 2021-01-05 08:22

Firstly, apologies for the bad question title - not entirely sure if I am asking the correct thing.

Normally I can do the following to access a field:



        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-05 08:36

    It is definitely doable but does get alot more complicated. If you want to do a completely dynamic LINQ query you should check out these posts by Scott Hanselman.

    • The Weekly Code Sample 48 - DynamicQueryable makes custom LINQ expressions easier
    • The Weekly Code Sample 47 - ASP.NET 3.5 Dynamic Data: FilterRepeaters and Dynamic Linq Query Generation

提交回复
热议问题