NDepend.API Documentation
DepthOfDeriveFrom Method (ExtensionMethodsCQLinqDependency)
NDepend.Reserved.CQLinq Namespace > ExtensionMethodsCQLinqDependency Class : DepthOfDeriveFrom Method
This derived type.
The NDepend.CodeModel.ICodeElement.FullName of the base class.
The string baseClassFullName can contain wildcard '*' characters but cannot be just a single wildcard string "*".
If one or several classes are matched by baseClassFullName, this method has a derives from any behavior.
Returns a non-null depth of inheritance value, if type is, directly or indirectly, deriving from a class whose NDepend.CodeModel.ICodeElement.FullName is baseClassFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method NDepend.CodeModel.IType.NDepend.CodeModel.IType.DepthOfDeriveFrom must be called instead.
Syntax
[Extension()]
public static Nullable<ushort> DepthOfDeriveFrom( 
   IType type,
   string baseClassFullName
)

Parameters

type
This derived type.
baseClassFullName
The NDepend.CodeModel.ICodeElement.FullName of the base class.
The string baseClassFullName can contain wildcard '*' characters but cannot be just a single wildcard string "*".
If one or several classes are matched by baseClassFullName, this method has a derives from any behavior.

Return Value

baseClass being a NDepend.CodeModel.IType whose NDepend.CodeModel.ICodeElement.FullName is baseClassFullName:
Returns null if type is not directly nor indirectly deriving from baseClass.
Returns 0 if type is a baseClass.
Returns 1 if type directly derives from baseClass.
Returns 2 if type directly derives from a base class that directly derives from a baseClass.
...
If a non-null number is returned, returns the lowest possible number.
Exceptions
ExceptionDescription
This extension method cannot be called from a program consuming NDepend.API. In such context, the method NDepend.CodeModel.IType.NDepend.CodeModel.IType.DepthOfDeriveFrom must be called instead.
Remarks
If one or several classes are matched by baseClassFullName, they will be listed in NDepend.CodeQuery.IQueryExecutionSuccessResult.TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.
Requirements

Target Platforms: Windows 11, 10, 8, 7 and Linux, MacOS with net8.0, net7.0 or net6.0 installed

See Also

Reference

ExtensionMethodsCQLinqDependency Class
ExtensionMethodsCQLinqDependency Members
BaseClass Property
BaseClasses Property
DeriveFrom Method
DepthOfDeriveFrom Method
DerivedTypes Property
DirectDerivedTypes Property
ThatDeriveFrom Method
ThatDeriveFromAny Method
ThatDirectlyDeriveFrom Method
ThatDirectlyDeriveFromAny Method
DepthOfDeriveFrom Method
DepthOfDeriveFromAny Method
NDepend.Reserved.CQLinq.ExtensionMethodsCQLinqDependency.DeriveFrom(NDepend.CodeModel.IType,System.String)