I am trying to create another custom query with NDepend, but cannot figure it out.
Here’s in pseudocode what I’d like to query:
var list
foreach type t
int newCount = 0
foreach type u in t.TypesUsed
if "new"-operator of u is called anywhere within t
newCount++;
end foreach
list.Add( new Tuple<Type, int>(t, newCount) )
end foreach
return list
I’d like to know how many times the “new”-operator is called anywhere within a type.
I am very new to the syntax of the NDepend queries. So some hints would help a lot 🙂
Thanks!
You can try this query, that lists for each type
t, all types instantiated in the code oft(i.e a type is instantiated when one of its constructor is called through thenewoperator).The result looks like: