Force Linq to not delay execution

前端 未结 4 1988
礼貌的吻别
礼貌的吻别 2021-02-12 15:12

In fact, this is the same question as this post:

How can I make sure my LINQ queries execute when called in my DAL, not in a delayed fashion?

But since he didn\'

4条回答
  •  孤独总比滥情好
    2021-02-12 15:54

    I know this thread is old... anyway, funny no-one mentioned .ToLast() yet. I'm doing something where linq is not much more than a glorified foreach driving some side effects where I don't really care about the query result... so I didn't want to allocate any more bogus memory than necessary.

提交回复
热议问题