How many methods in my classes ?

I won’t waste time on this post explaining why I had to do this, but I had to find the number of methods on a whole bunch of classes.

NDepend to the rescue. Using the CQLinq language I wrote

Application.Methods.Where(m => 
m.ParentType.Name == "ClassName1" ||
m.ParentType.Name == "ClassName2").
Count(m => !m.IsGeneratedByCompiler)

Now I’ll admit the list of classes was coded directly into the query, which is obviously no good for reusing the query, but this mean’t it was quick and easy to get the code up and running in no time at all – and thus get my answer.