Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does LINQ and Lambda expressions reduce Cyclomatic-complexity?

Does LINQ and Lambda expressions reduce cyclomatic-complexity? Just curious because CodeRush actually shows a reduction in cc when the VS analyzer increases it.

like image 505
user24985 Avatar asked Mar 19 '09 14:03

user24985


1 Answers

I suspect that the discrepancy may be due to deferred execution. When you use LINQ with lambda expressions, you're specifying code which will be run if you then iterate over the collection.

Personally I'm not so worried about cyclomatic complexity, but I'm absolutely sure that (when used appropriately) LINQ improves readability. That's what I really care about :)

like image 128
Jon Skeet Avatar answered Oct 09 '22 00:10

Jon Skeet