How do I build up LINQ dynamically

前端 未结 3 839
青春惊慌失措
青春惊慌失措 2020-12-10 06:50

I have a scenario where I have custom configured column names, associated operators like < > = between etc. and then a value associated.

I\'m trying to determine

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 07:21

    If you are talking about a string Where clause (rather than building the expression etc yourself) - then the Dynamic LINQ Library (in the 3.5 samples, IIRC) should suffice.

    Note that the example below is for database usage; but you can use it with LINQ-to-Objects by calling .AsQueryable() on your in-memory data.

提交回复
热议问题