使用NDepend,我该如何找到特定方法或属性的所有直接和间接用途?
特别是,我需要找到发生在使用路径中某个接口上的使用。谢谢!
特别是,我需要找到发生在使用路径中某个接口上的使用。谢谢!
在UI的任何地方右键单击一个方法,然后选择菜单:选择方法... > 直接或间接使用我的方法会导致一个代码查询,例如:
from m in Methods
let depth0 = m.DepthOfIsUsing("NUnit.Core.NUnitFramework+Assert.GetAssertCount()")
where depth0 >= 0 orderby depth0
select new { m, depth0 }
// Retrieve the target method by name
let methodTarget = Methods.WithFullName("NUnit.Core.NUnitFramework+Assert.GetAssertCount()").Single()
// Build a ICodeMetric<IMethod,ushort> representing the depth of indirect
// call of the target method.
let indirectCallDepth =
methodTarget.ToEnumerable()
.FillIterative(
methods => methods.SelectMany(
m => m.MethodsCallingMe.Union(m.OverriddensBase)))
from m in indirectCallDepth.DefinitionDomain
select new { m, callDepth = indirectCallDepth[m] }