What is NDepend?
NDepend is one of the popular tool to analyse the .NET code that supports huge number of code metrics and also includes some cool visualization of the dependencies in your .NET assembly and also lets you achieve high code quality.
Below is a screenshot of my Windows Phone project that was analysed using NDepend 4.
One of the cool feature of the NDepend 4 is the support for Code Query Linq (CQLinq) .The CQLinq lets the developers to query the .NET code using LINQ queries.
CQLinq query can be edited in Visual Studio or NDepend Professional (Standalone) Application.
CQLinq has some advantages like
- Easy to query the .NET code with the Linq query
- Let’s you to query a huge code base quickly
- Code completion or intellisense support
- Tooltip documentation on mouse hovering.
For example, assume that you need to identify all the methods in project that is more than 10 lines of code. How do we achieve it?
NDepend makes it easy with the CQLinq to solve scenarios like this.
from m in Methods where m.NbLinesOfCode >10
In the above example, there is a predefined domain called “Methods” which is a IEnumerable<Methods> that lets you to query the Methods. Similarly, NDepend defines other predefined domains like
- And more…
Interesting isn’t it? I will explore more about the NDepend and write about it in the coming posts.