NDepend.API Documentation
DepthOfAssignField Method (ExtensionMethodsCQLinqDependency)
NDepend.Reserved.CQLinq Namespace > ExtensionMethodsCQLinqDependency Class : DepthOfAssignField Method
This method.
The NDepend.CodeModel.ICodeElement.FullName of the assigned field.
The string assignedFieldFullName can contain wildcard '*' characters but cannot be just a single wildcard string "*".
If one or several fields are matched by assignedFieldFullName, this method has a assigning any behavior.
Returns a non-null depth value, if method is assigning, directly or indirectly, a field whose NDepend.CodeModel.ICodeElement.FullName is assignedFieldFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method NDepend.CodeModel.ExtensionMethodsSequenceUsage.NDepend.CodeModel.ExtensionMethodsSequenceUsage.DepthOfAssignAnyFields must be used instead.
Syntax
[Extension()]
public static Nullable<ushort> DepthOfAssignField( 
   IMethod method,
   string assignedFieldFullName
)

Parameters

method
This method.
assignedFieldFullName
The NDepend.CodeModel.ICodeElement.FullName of the assigned field.
The string assignedFieldFullName can contain wildcard '*' characters but cannot be just a single wildcard string "*".
If one or several fields are matched by assignedFieldFullName, this method has a assigning any behavior.

Return Value

assignedField being a NDepend.CodeModel.IField whose NDepend.CodeModel.ICodeElement.FullName is assignedFieldFullName:
Returns null if method is not directly nor indirectly assigning a assignedField.
Returns 0 if method is assigning a assignedField.
Returns 1 if method is calling a method that is assigning a assignedField.
Returns 2 if method is calling a method, that is calling a method, that is assigning a assignedField.
...
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 extension method NDepend.CodeModel.ExtensionMethodsSequenceUsage.NDepend.CodeModel.ExtensionMethodsSequenceUsage.DepthOfAssignAnyFields must be used instead.
Remarks
If one or several fields are matched by assignedFieldFullName, 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
IndirectlyAssignField Method
NDepend.Reserved.CQLinq.ExtensionMethodsCQLinqDependency.AssignField(NDepend.CodeModel.IMethod,System.String)