Perform calculation inside select statement in LINQ

前端 未结 5 869
攒了一身酷
攒了一身酷 2021-01-21 02:17

I have a situation where i have to calculate percentage of two values for example

IEnumerable result = 
    from r in renewalLists
    gro         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-21 02:31

    For this purpose, use the LINQ let operator.

    In general, I would recommend to split your big LINQ statement on several smaller ones. Otherwise, it will be very painful to debug this later.

提交回复
热议问题