I just saw a free cool tool, NDepend, which analyzes .NET assemblies and lets you get neet metrics. It also lets you run queries like:
WARN IF Count > 0 IN SELECT TYPES OUT OF NAMESPACES “System.Xml”
WHERE DepthOfIsUsing “System.Xml.XmlChildNodes” == 1
// Restrict the possibility to use the type “System.Xml.XmlChildNodes”
// only to certain namespace.
It also has a GUI front end:
The tool was written by Patrick Smacchia, who wrote Practical .NET2 and C#2, which I blogged about earlier.