Right-click the method anywhere in the user interface and select the menu: Select the method ...> ... that uses me (directly or indirectly) leads to a code request, for example:
from m in Methods let depth0 = m.DepthOfIsUsing("NUnit.Core.NUnitFramework+Assert.GetAssertCount()") where depth0 >= 0 orderby depth0 select new { m, depth0 }
The problem is that such a request gives indirect use, but does not look for calls that occur through the interface (or an overridden method declared in the base class).
We hope you receive a request for this request:
// 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] }
The two edge stones of this request are:
- Call FillIterative () to select a recursively indirect call.
- Call the IMethod.OverriddensBase property, as its name suggests. For method M, this returns an enumerable entire method declared in the base class or interface, overridden by M.
source share