C# 将Func的列表作为单个Func返回

C# 将Func的列表作为单个Func返回,c#,C#,我有一个func的列表 class SomeClass { List<Func<int, bool>> _funcList; } 最简单的方法是返回lambda函数。从要使用的列表中调用所有函数 _funcList.All(func => func(5)); 我们无法构造lambda来执行上述语句: var callAll = integerVal => _funcList.All(func => func(integerVal)); 完整示

我有一个func的列表

class SomeClass
{
  List<Func<int, bool>> _funcList;

}

最简单的方法是返回lambda函数。从要使用的列表中调用所有函数

_funcList.All(func => func(5));
我们无法构造lambda来执行上述语句:

var callAll = integerVal => _funcList.All(func => func(integerVal));
完整示例

class SomeClass
{
    List<Func<int, bool>> _funcList;

    Func<int, bool> GetAllTrueConditions()
    {
        //for each item in _funcList do AND and return
        return integerVal => _funcList.All(func => func(integerVal));
    }
}

是否要在一个函数调用中返回多次?委托可能是您的最佳选择:_funcList.Allf=>fsomeparameter是否正在查找此项?返回i=>函数席。
var callAll = integerVal => _funcList.All(func => func(integerVal));
class SomeClass
{
    List<Func<int, bool>> _funcList;

    Func<int, bool> GetAllTrueConditions()
    {
        //for each item in _funcList do AND and return
        return integerVal => _funcList.All(func => func(integerVal));
    }
}