Initializing a list with lambdas causes IL cyclotromatic complexity: why and how to remove this complexity? For example, the following code causes the static constructor of a class (which is actually generated by the compiler) to be very complex: 1 + list count.
static List<Predicate<string>> list = new List<Predicate<string>>() { s => s == null, s=> s.StartsWith("R"), ... With a lot of predicates like that …. };
Note: complexity is calculated using NDepend
c # lambda ndepend cyclomatic-complexity
sthiers
source share