Iterate with LINQ over a list and set founded varible

This question already has an answer here:

  • LINQ equivalent of foreach for IEnumerable<T> 21 answers

  • Why do you insist on linq? its not a good practice to use linq alll the time.

    How ever you can mix linq with foreach.

    foreach (var field in fieldExtension.Where(f => f.Name.Equals(item.Name)))
    {
        field.Access = true;
    }
    
    链接地址: http://www.djcxy.com/p/53004.html

    上一篇: List <T> .ForEach()方法消失了吗?

    下一篇: 在列表中迭代LINQ并设置创建的变量