Table of Contents

Class ExtensionMethodsCQLinqDependency

Namespace
NDepend.Reserved.CQLinq
Assembly
NDepend.API.dll

Presents extension methods on code elements, that provides a syntax friendly way to specify dependencies in CQLinq rules queries.

public static class ExtensionMethodsCQLinqDependency
Inheritance
ExtensionMethodsCQLinqDependency
Inherited Members

Remarks

These extension methods exist for CQLinq friendly syntax reasons and can only be called in a ICQLinqExecutionContext.
Indeed they all require a special resolving step prior to query execution, that resolves once for all code elements by name.
The user doesn't have to write this resolving code. This results in less syntax burden.
For each of these extension methods, there are one or several corresponding methods in NDepend.CodeModel, that can be called to get the same action done.
This pre-resolving step is weaved at CQLinq compilation time, the CQLinq compiler takes care of transforming calls to these extension methods to calls to their NDepend.CodeModel equivalent.
These extension methods cannot be called from a program consuming NDepend.API, since it would provoke the resolving step to be invoked for all code elements.

Methods (40)

AllowNoMatch(string)

Append the prefix "OPTIONAL:" to codeElementName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string), that takes a code element name string as argument, that if no code element is matched, no exception should be sent.

public static string AllowNoMatch(this string codeElementName)

Parameters

codeElementName string

The original code element name.

Returns

string

codeElementName prefixed with "OPTIONAL:".

See Also

AssignField(IMethod, string)

Returns true if method is assigning a field whose FullName is assignedFieldFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the property getter IMethod.AssignField(IField) must be used instead.

public static bool AssignField(this IMethod method, string assignedFieldFullName)

Parameters

method IMethod

This method.

assignedFieldFullName string

The 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

bool

assignedField being a IField whose FullName is assignedFieldFullName:
Returns true if method assigns a assignedField, otherwise returns false.

Remarks

If one or several fields are matched by assignedFieldFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the property getter IMethod.AssignField(IField) must be used instead.

See Also

CreateA(IMethod, string)

Returns true if method is calling a constructor of a type, whose FullName is createdTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IMethod.CreateA(IType) must be used instead.

public static bool CreateA(this IMethod method, string createdTypeFullName)

Parameters

method IMethod

This method.

createdTypeFullName string

The FullName of the instantiated type.
The string createdTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by createdTypeFullName, this method has a creates an instance of any behavior.

Returns

bool

createdType being a IType whose FullName is createdTypeFullName:
Returns true if method is creating an instance of createdType, otherwise returns false.

Remarks

If one or several types are matched by createdTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IMethod.CreateA(IType) must be used instead.

See Also

DepthOfAssignField(IMethod, string)

Returns a non-null depth value, if method is assigning, directly or indirectly, a field whose FullName is assignedFieldFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.DepthOfAssignAnyFields(IEnumerable<IMethod>, IEnumerable<IField>) must be used instead.

public static ushort? DepthOfAssignField(this IMethod method, string assignedFieldFullName)

Parameters

method IMethod

This method.

assignedFieldFullName string

The 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

ushort?

assignedField being a IField whose 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.

Remarks

If one or several fields are matched by assignedFieldFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.DepthOfAssignAnyFields(IEnumerable<IMethod>, IEnumerable<IField>) must be used instead.

See Also

DepthOfCreateA(IMethod, string)

Returns a non-null depth value, if method is creating, directly or indirectly, an instance of a type, whose FullName is createdTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.DepthOfCreateAny(IEnumerable<IMethod>, IEnumerable<IType>) must be used instead.

public static ushort? DepthOfCreateA(this IMethod method, string createdTypeFullName)

Parameters

method IMethod

This method.

createdTypeFullName string

The FullName of the instantiated type.
The string createdTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by createdTypeFullName, this method has a creates an instance of any behavior.

Returns

ushort?

createdType being a IType whose FullName is createdTypeFullName:
Returns null if method is not directly nor indirectly creating an instance of createdType.
Returns 0 if method is a constructor of createdType.
Returns 1 if method is calling a constructor of createdType.
Returns 2 if method is calling a method, that is calling a constructor of createdType.
...
If a non-null number is returned, returns the lowest possible number.

Remarks

If one or several types are matched by createdTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.DepthOfCreateAny(IEnumerable<IMethod>, IEnumerable<IType>) must be used instead.

See Also

DepthOfDeriveFrom(IType, string)

Returns a non-null depth of inheritance value, if type is, directly or indirectly, deriving from a class whose FullName is baseClassFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IType.DepthOfDeriveFrom(IType) must be called instead.

public static ushort? DepthOfDeriveFrom(this IType type, string baseClassFullName)

Parameters

type IType

This derived type.

baseClassFullName string

The 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

ushort?

baseClass being a IType whose 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.

Remarks

If one or several classes are matched by baseClassFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IType.DepthOfDeriveFrom(IType) must be called instead.

See Also

DepthOfIsUsedBy(IUsed, string)

Returns a non-null depth of usage value, if usedCodeElement is directly or indirectly used by a ICodeElement whose FullName is userCodeElementFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.DepthOfIsUsedByAny<TUsed, TUser>(IEnumerable<TUsed>, IEnumerable<TUser>) must be called instead.

public static ushort? DepthOfIsUsedBy(this IUsed usedCodeElement, string userCodeElementFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userCodeElementFullName string

The FullName of the code element user.
The string userCodeElementFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by userCodeElementFullName, this method has a used by any behavior.

If userCodeElementFullName matches several code elements of different kinds (like some assemblies and some namespaces) a compilation resolving error is emitted.
To solve this issue, the string can be prefixed with "ASSEMBLY:", "NAMESPACE:", "TYPE:", "METHOD:", "FIELD:", "PROPERTY:" or "EVENT:" to precise the kind of code element to match.
Alternatively, the string extensions methods MatchAssembly(string), MatchNamespace(string), MatchType(string), MatchMethod(string), MatchField(string), MatchProperty(string) or MatchEvent(string) can be used instead, to insert this prefix.

If no code element is matched by userCodeElementFullName, the CQLinq query will emit a compilation error, except if userCodeElementFullName is prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.

Returns

ushort?

userCodeElement being a ICodeElement whose FullName is userCodeElementFullName:
Returns null if usedCodeElement is not directly nor indirectly used by a userCodeElement.
Returns 0 if usedCodeElement is, or belongs to, a userCodeElement.
Returns 1 if usedCodeElement is directly used by a userCodeElement.
Returns 2 if usedCodeElement is directly used by a code element that is directly used by a userCodeElement.
...
If a non-null number is returned, returns the lowest possible number.

Remarks

If one or several code elements are matched by userCodeElementFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.DepthOfIsUsedByAny<TUsed, TUser>(IEnumerable<TUsed>, IEnumerable<TUser>) must be called instead.

See Also

DepthOfIsUsing(IUser, string)

Returns a non-null depth of usage value, if userCodeElement is directly or indirectly using a ICodeElement whose FullName is usedCodeElementFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.DepthOfIsUsingAny<TUser, TUsed>(IEnumerable<TUser>, IEnumerable<TUsed>) must be called instead.

public static ushort? DepthOfIsUsing(this IUser userCodeElement, string usedCodeElementFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedCodeElementFullName string

The FullName of the code element used.
The string usedCodeElementFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by usedCodeElementFullName, this method has a using any behavior.

If usedCodeElementFullName matches several code elements of different kinds (like some assemblies and some namespaces) a compilation resolving error is emitted.
To solve this issue, the string can be prefixed with "ASSEMBLY:", "NAMESPACE:", "TYPE:", "METHOD:", "FIELD:", "PROPERTY:" or "EVENT:" to precise the kind of code element to match.
Alternatively, the string extensions methods MatchAssembly(string), MatchNamespace(string), MatchType(string), MatchMethod(string), MatchField(string), MatchProperty(string) or MatchEvent(string) can be used instead, to insert this prefix.

If no code element is matched by usedCodeElementFullName, the CQLinq query will emit a compilation error, except if usedCodeElementFullName is prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.

Returns

ushort?

usedCodeElement being a ICodeElement whose FullName is usedCodeElementFullName:
Returns null if userCodeElement is not directly nor indirectly using a usedCodeElement.
Returns 0 if userCodeElement is, or belongs to, a usedCodeElement.
Returns 1 if userCodeElement is directly using a usedCodeElement.
Returns 2 if userCodeElement is directly using a code element that directly uses a usedCodeElement.
...
If a non-null number is returned, returns the lowest possible number.

Remarks

If one or several code elements are matched by usedCodeElementFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.DepthOfIsUsingAny<TUser, TUsed>(IEnumerable<TUser>, IEnumerable<TUsed>) must be called instead.

See Also

DeriveFrom(IType, string)

Returns true if type is, directly or indirectly, deriving from a class whose FullName is baseClassFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IType.DeriveFrom(IType) must be called instead.

public static bool DeriveFrom(this IType type, string baseClassFullName)

Parameters

type IType

This derived type.

baseClassFullName string

The 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

bool

baseClass being a IType whose FullName is baseClassFullName:
Returns true if type is, directly or indirectly, deriving from a baseClass, otherwise returns false.

Remarks

If one or several classes are matched by baseClassFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IType.DeriveFrom(IType) must be called instead.

See Also

FieldTypeIs(IField, string)

Returns true if field has a field type whose FullName is fieldTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the property getter IField.FieldType must be used instead.

public static bool FieldTypeIs(this IField field, string fieldTypeFullName)

Parameters

field IField

This field.

fieldTypeFullName string

The FullName of this field's type.
The string fieldTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by fieldTypeFullName, this method has a has any field type behavior.

Returns

bool

fieldType being a IType whose FullName is fieldTypeFullName:
Returns true if field has for field type a fieldType, otherwise returns false.

Remarks

If one or several types are matched by fieldTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the property getter IField.FieldType must be used instead.

See Also

FromAssembly(string, string)

Append the prefix "FROM_ASM{assemblyName}" to codeElementName to restreint code element search by name only to a certain assembly.

public static string FromAssembly(this string codeElementName, string assemblyName)

Parameters

codeElementName string

The original code element name.

assemblyName string

The original code element name.

Returns

string

codeElementName prefixed with "FROM_ASM{assemblyName}".

HasAttribute(IAttributeTarget, string)

Returns true if this attributeTargetCodeElement is directly tagged by an attribute class whose FullName is attributeTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IAttributeTarget.HasAttribute(IType) must be called instead.

public static bool HasAttribute(this IAttributeTarget attributeTargetCodeElement, string attributeTypeFullName)

Parameters

attributeTargetCodeElement IAttributeTarget

This IAttributeTarget object. A IAttributeTarget object can be a IAssembly, IType, IMethod or IField object.

attributeTypeFullName string

The FullName of the attribute type.
The string attributeTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by attributeTypeFullName, this method has a tagged by any behavior.

Returns

bool

Remarks

If one or several attribute classes are matched by attributeTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IAttributeTarget.HasAttribute(IType) must be called instead.

Implement(IType, string)

Returns true if type implements an interface whose FullName is interfaceFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IType.Implement(IType) must be called instead.

public static bool Implement(this IType type, string interfaceFullName)

Parameters

type IType

This implementer type.

interfaceFullName string

The FullName of the interface.
The string interfaceFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several interfaces are matched by interfaceFullName, this method has a implements any behavior.

Returns

bool

interface being a IType whose FullName is interfaceFullName:
Returns true if type implements a interface, otherwise returns false.

Remarks

If one or several interfaces are matched by interfaceFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IType.Implement(IType) must be called instead.

See Also

IndirectlyAssignField(IMethod, string)

Returns true if method is assigning, directly or indirectly, a field whose FullName is assignedFieldFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.ThatIndirectlyAssignAnyFields(IEnumerable<IMethod>, IEnumerable<IField>) must be used instead.

public static bool IndirectlyAssignField(this IMethod method, string assignedFieldFullName)

Parameters

method IMethod

This method.

assignedFieldFullName string

The 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

bool

assignedField being a IField whose FullName is assignedFieldFullName:
Returns true if method assigns, directly or indirectly, a assignedField, otherwise returns false.

Remarks

If one or several fields are matched by assignedFieldFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.ThatIndirectlyAssignAnyFields(IEnumerable<IMethod>, IEnumerable<IField>) must be used instead.

See Also

IndirectlyCreateA(IMethod, string)

Returns true if method is calling, directly or indirectly, a constructor of a type, whose FullName is createdTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.ThatIndirectlyCreateAny(IEnumerable<IMethod>, IEnumerable<IType>) must be used instead.

public static bool IndirectlyCreateA(this IMethod method, string createdTypeFullName)

Parameters

method IMethod

This method.

createdTypeFullName string

The FullName of the instantiated type.
The string createdTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by createdTypeFullName, this method has a creates an instance of any behavior.

Returns

bool

createdType being a IType whose FullName is createdTypeFullName:
Returns true if method is calling, directly or indirectly, a constructor of createdType, otherwise returns false.

Remarks

If one or several types are matched by createdTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.ThatIndirectlyCreateAny(IEnumerable<IMethod>, IEnumerable<IType>) must be used instead.

See Also

IsIndirectlyUsedBy(IUsed, string)

Returns true if usedCodeElement is, directly or indirectly, used by a ICodeElement whose FullName is userCodeElementFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.IndirectlyUsedByAny<TUsed, TUser>(IEnumerable<TUsed>, IEnumerable<TUser>) must be called instead.

public static bool IsIndirectlyUsedBy(this IUsed usedCodeElement, string userCodeElementFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userCodeElementFullName string

The FullName of the code element user.
The string userCodeElementFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by userCodeElementFullName, this method has a used by any behavior.

If userCodeElementFullName matches several code elements of different kinds (like some assemblies and some namespaces) a compilation resolving error is emitted.
To solve this issue, the string can be prefixed with "ASSEMBLY:", "NAMESPACE:", "TYPE:", "METHOD:", "FIELD:", "PROPERTY:" or "EVENT:" to precise the kind of code element to match.
Alternatively, the string extensions methods MatchAssembly(string), MatchNamespace(string), MatchType(string), MatchMethod(string), MatchField(string), MatchProperty(string) or MatchEvent(string) can be used instead, to insert this prefix.

If no code element is matched by userCodeElementFullName, the CQLinq query will emit a compilation error, except if userCodeElementFullName is prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.

Returns

bool

userCodeElement being a ICodeElement whose FullName is userCodeElementFullName:
Returns true if usedCodeElement is, directly or indirectly, used by a userCodeElement, otherwise returns false.

Remarks

If one or several code elements are matched by userCodeElementFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.IndirectlyUsedByAny<TUsed, TUser>(IEnumerable<TUsed>, IEnumerable<TUser>) must be called instead.

See Also

IsIndirectlyUsing(IUser, string)

Returns true if userCodeElement is, directly or indirectly, using a ICodeElement whose FullName is usedCodeElementFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsSequenceUsage.IndirectlyUsingAny<TUser, TUsed>(IEnumerable<TUser>, IEnumerable<TUsed>) must be called instead.

public static bool IsIndirectlyUsing(this IUser userCodeElement, string usedCodeElementFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedCodeElementFullName string

The FullName of the code element used.
The string usedCodeElementFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by usedCodeElementFullName, this method has a using any behavior.

If usedCodeElementFullName matches several code elements of different kinds (like some assemblies and some namespaces) a compilation resolving error is emitted.
To solve this issue, the string can be prefixed with "ASSEMBLY:", "NAMESPACE:", "TYPE:", "METHOD:", "FIELD:", "PROPERTY:" or "EVENT:" to precise the kind of code element to match.
Alternatively, the string extensions methods MatchAssembly(string), MatchNamespace(string), MatchType(string), MatchMethod(string), MatchField(string), MatchProperty(string) or MatchEvent(string) can be used instead, to insert this prefix.

If no code element is matched by usedCodeElementFullName, the CQLinq query will emit a compilation error, except if usedCodeElementFullName is prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.

Returns

bool

userCodeElement being a ICodeElement whose FullName is usedCodeElementFullName:
Returns true if userCodeElement is, directly or indirectly, using a userCodeElement, otherwise returns false.

Remarks

If one or several code elements are matched by usedCodeElementFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the extension method ExtensionMethodsSequenceUsage.IndirectlyUsingAny<TUser, TUsed>(IEnumerable<TUser>, IEnumerable<TUsed>) must be called instead.

See Also

IsUsedBy(IUsed, string)

Returns true if this usedCodeElement is directly used by a ICodeElement whose FullName is userCodeElementFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUsed.IsUsedBy(ICodeElement) must be called instead.

public static bool IsUsedBy(this IUsed usedCodeElement, string userCodeElementFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userCodeElementFullName string

The FullName of the code element user.

The string userCodeElementFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by userCodeElementFullName, this method has a used by any behavior.

If userCodeElementFullName matches several code elements of different kinds (like some assemblies and some namespaces) a compilation resolving error is emitted.
To solve this issue, the string can be prefixed with "ASSEMBLY:", "NAMESPACE:", "TYPE:", "METHOD:", "FIELD:", "PROPERTY:" or "EVENT:" to precise the kind of code element to match.
Alternatively, the string extensions methods MatchAssembly(string), MatchNamespace(string), MatchType(string), MatchMethod(string), MatchField(string), MatchProperty(string) or MatchEvent(string) can be used instead, to insert this prefix.

If no code element is matched by userCodeElementFullName, the CQLinq query will emit a compilation error, except if userCodeElementFullName is prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.

Returns

bool

Remarks

If one or several code elements are matched by userCodeElementFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUsed.IsUsedBy(ICodeElement) must be called instead.

See Also

IsUsedByAssembly(IUsed, string)

Returns true if this usedCodeElement is directly used by a IAssembly whose Name is userAssemblyName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUsed.IsUsedByAssembly(IAssembly) must be called instead.

public static bool IsUsedByAssembly(this IUsed usedCodeElement, string userAssemblyName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userAssemblyName string

The Name of the assembly user.
The string userAssemblyName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several assemblies are matched by userAssemblyName, this method has a used by any behavior.

Returns

bool

Remarks

If one or several assemblies are matched by userAssemblyName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUsed.IsUsedByAssembly(IAssembly) must be called instead.

IsUsedByEvent(IUsed, string)

Returns true if this usedCodeElement is directly used by a IEvent whose FullName is userEventFullName. This event can only be called in a ICQLinqExecutionContext, otherwise the event IUsed.IsUsedByEvent(IEvent) must be called instead.

public static bool IsUsedByEvent(this IUsed usedCodeElement, string userEventFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IEvent or IField object.

userEventFullName string

The FullName of the event user.
The string userEventFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several events are matched by userEventFullName, this event has a used by any behavior.

Returns

bool

Remarks

If one or several events are matched by userEventFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this event has a constant time complexity.

Exceptions

NotImplementedException

This extension event cannot be called from a program consuming NDepend.API. In such context, the event IUsed.IsUsedByEvent(IEvent) must be called instead.

IsUsedByMethod(IUsed, string)

Returns true if this usedCodeElement is directly used by a IMethod whose FullName is userMethodFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUsed.IsUsedByMethod(IMethod) must be called instead.

public static bool IsUsedByMethod(this IUsed usedCodeElement, string userMethodFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userMethodFullName string

The FullName of the method user.
The string userMethodFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several methods are matched by userMethodFullName, this method has a used by any behavior.

Returns

bool

Remarks

If one or several methods are matched by userMethodFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUsed.IsUsedByMethod(IMethod) must be called instead.

IsUsedByNamespace(IUsed, string)

Returns true if this usedCodeElement is directly used by a INamespace whose Name is userNamespaceName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUsed.IsUsedByNamespace(INamespace) must be called instead.

public static bool IsUsedByNamespace(this IUsed usedCodeElement, string userNamespaceName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userNamespaceName string

The Name of the namespace user.
The string userNamespaceName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several namespaces are matched by userNamespaceName, this method has a used by any behavior.

Returns

bool

Remarks

If one or several namespaces are matched by userNamespaceName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUsed.IsUsedByNamespace(INamespace) must be called instead.

IsUsedByProperty(IUsed, string)

Returns true if this usedCodeElement is directly used by a IProperty whose FullName is userPropertyFullName. This property can only be called in a ICQLinqExecutionContext, otherwise the property IUsed.IsUsedByProperty(IProperty) must be called instead.

public static bool IsUsedByProperty(this IUsed usedCodeElement, string userPropertyFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IProperty or IField object.

userPropertyFullName string

The FullName of the property user.
The string userPropertyFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several properties are matched by userPropertyFullName, this property has a used by any behavior.

Returns

bool

Remarks

If one or several properties are matched by userPropertyFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this property has a constant time complexity.

Exceptions

NotImplementedException

This extension property cannot be called from a program consuming NDepend.API. In such context, the property IUsed.IsUsedByProperty(IProperty) must be called instead.

IsUsedByType(IUsed, string)

Returns true if this usedCodeElement is directly used by a IType whose FullName is userTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUsed.IsUsedByType(IType) must be called instead.

public static bool IsUsedByType(this IUsed usedCodeElement, string userTypeFullName)

Parameters

usedCodeElement IUsed

This IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.

userTypeFullName string

The FullName of the type user.
The string userTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by userTypeFullName, this method has a used by any behavior.

Returns

bool

Remarks

If one or several types are matched by userTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUsed.IsUsedByType(IType) must be called instead.

IsUsing(IUser, string)

Returns true if this userCodeElement is directly using a ICodeElement whose FullName is usedCodeElementFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsing(ICodeElement) must be called instead.

public static bool IsUsing(this IUser userCodeElement, string usedCodeElementFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedCodeElementFullName string

The FullName of the code element used.
The string usedCodeElementFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched by usedCodeElementFullName, this method has a using any behavior.

If usedCodeElementFullName matches several code elements of different kinds (like some assemblies and some namespaces) a compilation resolving error is emitted.
To solve this issue, the string can be prefixed with "ASSEMBLY:", "NAMESPACE:", "TYPE:", "METHOD:", "FIELD:", "PROPERTY:" or "EVENT:" to precise the kind of code element to match.
Alternatively, the string extensions methods MatchAssembly(string), MatchNamespace(string), MatchType(string), MatchMethod(string), MatchField(string), MatchProperty(string) or MatchEvent(string) can be used instead, to insert this prefix.

If no code element is matched by usedCodeElementFullName, the CQLinq query will emit a compilation error, except if usedCodeElementFullName is prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.

Returns

bool

Remarks

If one or several code elements are matched by usedCodeElementFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsing(ICodeElement) must be called instead.

See Also

IsUsingAssembly(IUser, string)

Returns true if this userCodeElement is directly using a IAssembly whose Name is usedAssemblyName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingAssembly(IAssembly) must be called instead.

public static bool IsUsingAssembly(this IUser userCodeElement, string usedAssemblyName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedAssemblyName string

The Name of the assembly used.
The string usedAssemblyName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several assemblies are matched by usedAssemblyName, this method has a using any behavior.

Returns

bool

Remarks

If one or several assemblies are matched by usedAssemblyName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingAssembly(IAssembly) must be called instead.

IsUsingEvent(IUser, string)

Returns true if this userCodeElement is directly using a IEvent whose FullName is usedEventFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingEvent(IEvent) must be called instead.

public static bool IsUsingEvent(this IUser userCodeElement, string usedEventFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedEventFullName string

The FullName of the event used.
The string usedEventFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several events are matched by usedEventFullName, this method has a using any behavior.

Returns

bool

Remarks

If one or several events are matched by usedEventFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingEvent(IEvent) must be called instead.

IsUsingField(IUser, string)

Returns true if this userCodeElement is directly using a IField whose FullName is usedFieldFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingField(IField) must be called instead.

public static bool IsUsingField(this IUser userCodeElement, string usedFieldFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedFieldFullName string

The FullName of the field used.
The string usedFieldFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several fields are matched by usedFieldFullName, this method has a using any behavior.

Returns

bool

Remarks

If one or several fields are matched by usedFieldFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingField(IField) must be called instead.

IsUsingMethod(IUser, string)

Returns true if this userCodeElement is directly using a IMethod whose FullName is usedMethodFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingMethod(IMethod) must be called instead.

public static bool IsUsingMethod(this IUser userCodeElement, string usedMethodFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedMethodFullName string

The FullName of the method used.
The string usedMethodFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several methods are matched by usedMethodFullName, this method has a using any behavior.

Returns

bool

Remarks

If one or several methods are matched by usedMethodFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingMethod(IMethod) must be called instead.

IsUsingNamespace(IUser, string)

Returns true if this userCodeElement is directly using a INamespace whose Name is usedNamespaceName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingNamespace(INamespace) must be called instead.

public static bool IsUsingNamespace(this IUser userCodeElement, string usedNamespaceName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedNamespaceName string

The Name of the namespace used.
The string usedNamespaceName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several namespaces are matched by usedNamespaceName, this method has a using any behavior.

Returns

bool

Remarks

If one or several namespaces are matched by usedNamespaceName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingNamespace(INamespace) must be called instead.

IsUsingProperty(IUser, string)

Returns true if this userCodeElement is directly using a IProperty whose FullName is usedPropertyFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingProperty(IProperty) must be called instead.

public static bool IsUsingProperty(this IUser userCodeElement, string usedPropertyFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedPropertyFullName string

The FullName of the property used.
The string usedPropertyFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several properties are matched by usedPropertyFullName, this method has a using any behavior.

Returns

bool

Remarks

If one or several properties are matched by usedPropertyFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingProperty(IProperty) must be called instead.

IsUsingType(IUser, string)

Returns true if this userCodeElement is directly using a IType whose FullName is usedTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method IUser.IsUsingType(IType) must be called instead.

public static bool IsUsingType(this IUser userCodeElement, string usedTypeFullName)

Parameters

userCodeElement IUser

This IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.

usedTypeFullName string

The FullName of the type used.
The string usedTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by usedTypeFullName, this method has a using any behavior.

Returns

bool

Remarks

If one or several types are matched by usedTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IUser.IsUsingType(IType) must be called instead.

MatchAssembly(string)

Append the prefix "ASSEMBLY:" to assemblyName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only assemblies can be matched by name.

public static string MatchAssembly(this string assemblyName)

Parameters

assemblyName string

The original code element name.

Returns

string

assemblyName prefixed with "ASSEMBLY:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

MatchEvent(string)

Append the prefix "EVENT:" to eventFullName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only events can be matched by name.

public static string MatchEvent(this string eventFullName)

Parameters

eventFullName string

The original code element name.

Returns

string

eventFullName prefixed with "EVENT:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

MatchField(string)

Append the prefix "FIELD:" to fieldFullName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only fields can be matched by name.

public static string MatchField(this string fieldFullName)

Parameters

fieldFullName string

The original code element name.

Returns

string

fieldFullName prefixed with "FIELD:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

MatchMethod(string)

Append the prefix "METHOD:" to methodFullName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only methods can be matched by name.

public static string MatchMethod(this string methodFullName)

Parameters

methodFullName string

The original code element name.

Returns

string

methodFullName prefixed with "METHOD:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

MatchNamespace(string)

Append the prefix "NAMESPACE:" to namespaceName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only namespaces can be matched by name.

public static string MatchNamespace(this string namespaceName)

Parameters

namespaceName string

The original code element name.

Returns

string

namespaceName prefixed with "NAMESPACE:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

MatchProperty(string)

Append the prefix "PROPERTY:" to propertyFullName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only propertys can be matched by name.

public static string MatchProperty(this string propertyFullName)

Parameters

propertyFullName string

The original code element name.

Returns

string

propertyFullName prefixed with "PROPERTY:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

MatchType(string)

Append the prefix "TYPE:" to typeFullName to precise to a method such as IsUsedBy(IUsed, string) or IsUsing(IUser, string) that takes a code element name string as argument, that only types can be matched by name.

public static string MatchType(this string typeFullName)

Parameters

typeFullName string

The original code element name.

Returns

string

typeFullName prefixed with "TYPE:".

Exceptions

InvalidOperationException

Two different code element kind prefixes cannot be inserted.

See Also

ReturnTypeIs(IMethod, string)

Returns true if method has a return value of a type whose FullName is returnTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the property getter IMethod.ReturnType must be used instead.

public static bool ReturnTypeIs(this IMethod method, string returnTypeFullName)

Parameters

method IMethod

This method.

returnTypeFullName string

The FullName of this method's return type.
The string returnTypeFullName can contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched by returnTypeFullName, this method has a returns any behavior.

Returns

bool

returnType being a IType whose FullName is returnTypeFullName:
Returns true if method returns a returnType, otherwise returns false.

Remarks

If one or several types are matched by returnTypeFullName, they will be listed in TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the property getter IMethod.ReturnType must be used instead.

See Also