sth*_*ers 6 c# lambda ndepend cyclomatic-complexity
使用lambdas初始化列表会导致高IL圈复杂度:为什么以及如何消除这种复杂性?例如,下面的代码导致类的静态构造函数(实际上是编译器生成的)非常复杂:1 +列表计数.
static List<Predicate<string>> list = new List<Predicate<string>>()
{
s => s == null,
s=> s.StartsWith(“R”),
... With a lot of predicates like that ….
};
Run Code Online (Sandbox Code Playgroud)
注意:复杂度用计算 NDepend