This trend metric is written in CQLinq, C# LINQ over the NDepend code model.
It ships with every new NDepend project: you can read it, adapt it, or use it as a starting point for your own custom rules.
// <TrendMetric Name="# Third-Party Fields Used" Unit="Fields" />
from f in ThirdParty.Fields
where !f.ParentType.IsEnumeration
select new { f, f.MethodsUsingMe }