Func <>动态添加额外参数

Ton*_*ony 2 c#

如何在Func<>表达式中添加额外的参数?就像是:

Func<char, bool> myPredicate = (x) => (char.IsLetter(x) || x == 'X');

...

"abc".All(x => char.IsDigit(x) || myPredicate);
Run Code Online (Sandbox Code Playgroud)

但是我收到了一个错误

运营商'||' 不能应用于'bool'和Func <char,bool>类型的操作数

Ous*_* D. 6

你需要调用这样的myPredicate函数:

"abc".All(x => char.IsDigit(x) || myPredicate(x));
Run Code Online (Sandbox Code Playgroud)