Class ExtensionMethodsCQLinqDependency
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
codeElementNamestringThe original code element name.
Returns
- string
codeElementNameprefixed 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
methodIMethodThis method.
assignedFieldFullNamestringThe FullName of the assigned field.
The stringassignedFieldFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several fields are matched byassignedFieldFullName, this method has a assigning any behavior.
Returns
- bool
assignedField being a IField whose FullName is
assignedFieldFullName:
Returns true ifmethodassigns 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
methodIMethodThis method.
createdTypeFullNamestringThe FullName of the instantiated type.
The stringcreatedTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched bycreatedTypeFullName, this method has a creates an instance of any behavior.
Returns
- bool
createdType being a IType whose FullName is
createdTypeFullName:
Returns true ifmethodis 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
methodIMethodThis method.
assignedFieldFullNamestringThe FullName of the assigned field.
The stringassignedFieldFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several fields are matched byassignedFieldFullName, this method has a assigning any behavior.
Returns
- ushort?
assignedField being a IField whose FullName is
assignedFieldFullName:
Returns null ifmethodis not directly nor indirectly assigning a assignedField.
Returns 0 ifmethodis assigning a assignedField.
Returns 1 ifmethodis calling a method that is assigning a assignedField.
Returns 2 ifmethodis 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
methodIMethodThis method.
createdTypeFullNamestringThe FullName of the instantiated type.
The stringcreatedTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched bycreatedTypeFullName, this method has a creates an instance of any behavior.
Returns
- ushort?
createdType being a IType whose FullName is
createdTypeFullName:
Returns null ifmethodis not directly nor indirectly creating an instance of createdType.
Returns 0 ifmethodis a constructor of createdType.
Returns 1 ifmethodis calling a constructor of createdType.
Returns 2 ifmethodis 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
typeITypeThis derived type.
baseClassFullNamestringThe FullName of the base class.
The stringbaseClassFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several classes are matched bybaseClassFullName, this method has a derives from any behavior.
Returns
- ushort?
baseClass being a IType whose FullName is
baseClassFullName:
Returns null iftypeis not directly nor indirectly deriving from baseClass.
Returns 0 iftypeis a baseClass.
Returns 1 iftypedirectly derives from baseClass.
Returns 2 iftypedirectly 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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userCodeElementFullNamestringThe FullName of the code element user.
The stringuserCodeElementFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byuserCodeElementFullName, this method has a used by any behavior.
IfuserCodeElementFullNamematches 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 byuserCodeElementFullName, the CQLinq query will emit a compilation error, except ifuserCodeElementFullNameis 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 ifusedCodeElementis not directly nor indirectly used by a userCodeElement.
Returns 0 ifusedCodeElementis, or belongs to, a userCodeElement.
Returns 1 ifusedCodeElementis directly used by a userCodeElement.
Returns 2 ifusedCodeElementis 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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedCodeElementFullNamestringThe FullName of the code element used.
The stringusedCodeElementFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byusedCodeElementFullName, this method has a using any behavior.
IfusedCodeElementFullNamematches 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 byusedCodeElementFullName, the CQLinq query will emit a compilation error, except ifusedCodeElementFullNameis 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 ifuserCodeElementis not directly nor indirectly using a usedCodeElement.
Returns 0 ifuserCodeElementis, or belongs to, a usedCodeElement.
Returns 1 ifuserCodeElementis directly using a usedCodeElement.
Returns 2 ifuserCodeElementis 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
typeITypeThis derived type.
baseClassFullNamestringThe FullName of the base class.
The stringbaseClassFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several classes are matched bybaseClassFullName, this method has a derives from any behavior.
Returns
- bool
baseClass being a IType whose FullName is
baseClassFullName:
Returns true iftypeis, 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
fieldIFieldThis field.
fieldTypeFullNamestringThe FullName of this field's type.
The stringfieldTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched byfieldTypeFullName, this method has a has any field type behavior.
Returns
- bool
fieldType being a IType whose FullName is
fieldTypeFullName:
Returns true iffieldhas 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
codeElementNamestringThe original code element name.
assemblyNamestringThe original code element name.
Returns
- string
codeElementNameprefixed 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
attributeTargetCodeElementIAttributeTargetThis IAttributeTarget object. A IAttributeTarget object can be a IAssembly, IType, IMethod or IField object.
attributeTypeFullNamestringThe FullName of the attribute type.
The stringattributeTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byattributeTypeFullName, this method has a tagged by any behavior.
Returns
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
typeITypeThis implementer type.
interfaceFullNamestringThe FullName of the interface.
The stringinterfaceFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several interfaces are matched byinterfaceFullName, this method has a implements any behavior.
Returns
- bool
interface being a IType whose FullName is
interfaceFullName:
Returns true iftypeimplements 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
methodIMethodThis method.
assignedFieldFullNamestringThe FullName of the assigned field.
The stringassignedFieldFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several fields are matched byassignedFieldFullName, this method has a assigning any behavior.
Returns
- bool
assignedField being a IField whose FullName is
assignedFieldFullName:
Returns true ifmethodassigns, 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
methodIMethodThis method.
createdTypeFullNamestringThe FullName of the instantiated type.
The stringcreatedTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched bycreatedTypeFullName, this method has a creates an instance of any behavior.
Returns
- bool
createdType being a IType whose FullName is
createdTypeFullName:
Returns true ifmethodis 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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userCodeElementFullNamestringThe FullName of the code element user.
The stringuserCodeElementFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byuserCodeElementFullName, this method has a used by any behavior.
IfuserCodeElementFullNamematches 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 byuserCodeElementFullName, the CQLinq query will emit a compilation error, except ifuserCodeElementFullNameis 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 ifusedCodeElementis, 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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedCodeElementFullNamestringThe FullName of the code element used.
The stringusedCodeElementFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byusedCodeElementFullName, this method has a using any behavior.
IfusedCodeElementFullNamematches 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 byusedCodeElementFullName, the CQLinq query will emit a compilation error, except ifusedCodeElementFullNameis 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 ifuserCodeElementis, 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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userCodeElementFullNamestringThe FullName of the code element user.
The stringuserCodeElementFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byuserCodeElementFullName, this method has a used by any behavior.
IfuserCodeElementFullNamematches 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 byuserCodeElementFullName, the CQLinq query will emit a compilation error, except ifuserCodeElementFullNameis prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.
Returns
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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userAssemblyNamestringThe Name of the assembly user.
The stringuserAssemblyNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several assemblies are matched byuserAssemblyName, this method has a used by any behavior.
Returns
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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IEvent or IField object.
userEventFullNamestringThe FullName of the event user.
The stringuserEventFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several events are matched byuserEventFullName, this event has a used by any behavior.
Returns
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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userMethodFullNamestringThe FullName of the method user.
The stringuserMethodFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several methods are matched byuserMethodFullName, this method has a used by any behavior.
Returns
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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userNamespaceNamestringThe Name of the namespace user.
The stringuserNamespaceNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several namespaces are matched byuserNamespaceName, this method has a used by any behavior.
Returns
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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IProperty or IField object.
userPropertyFullNamestringThe FullName of the property user.
The stringuserPropertyFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several properties are matched byuserPropertyFullName, this property has a used by any behavior.
Returns
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
usedCodeElementIUsedThis IUsed object. A IUsed object can be a IAssembly, INamespace, IMember, IType, IMethod or IField object.
userTypeFullNamestringThe FullName of the type user.
The stringuserTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched byuserTypeFullName, this method has a used by any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedCodeElementFullNamestringThe FullName of the code element used.
The stringusedCodeElementFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several code elements are matched byusedCodeElementFullName, this method has a using any behavior.
IfusedCodeElementFullNamematches 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 byusedCodeElementFullName, the CQLinq query will emit a compilation error, except ifusedCodeElementFullNameis prefixed with "OPTIONAL:".
Alternatively, the string extensions methods AllowNoMatch(string) can be used instead, to insert the "OPTIONAL:" prefix.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedAssemblyNamestringThe Name of the assembly used.
The stringusedAssemblyNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several assemblies are matched byusedAssemblyName, this method has a using any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedEventFullNamestringThe FullName of the event used.
The stringusedEventFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several events are matched byusedEventFullName, this method has a using any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedFieldFullNamestringThe FullName of the field used.
The stringusedFieldFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several fields are matched byusedFieldFullName, this method has a using any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedMethodFullNamestringThe FullName of the method used.
The stringusedMethodFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several methods are matched byusedMethodFullName, this method has a using any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedNamespaceNamestringThe Name of the namespace used.
The stringusedNamespaceNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several namespaces are matched byusedNamespaceName, this method has a using any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedPropertyFullNamestringThe FullName of the property used.
The stringusedPropertyFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several properties are matched byusedPropertyFullName, this method has a using any behavior.
Returns
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
userCodeElementIUserThis IUser object. A IUser object can be a IAssembly, INamespace, IType or IMethod object.
usedTypeFullNamestringThe FullName of the type used.
The stringusedTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched byusedTypeFullName, this method has a using any behavior.
Returns
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
assemblyNamestringThe original code element name.
Returns
- string
assemblyNameprefixed 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
eventFullNamestringThe original code element name.
Returns
- string
eventFullNameprefixed 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
fieldFullNamestringThe original code element name.
Returns
- string
fieldFullNameprefixed 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
methodFullNamestringThe original code element name.
Returns
- string
methodFullNameprefixed 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
namespaceNamestringThe original code element name.
Returns
- string
namespaceNameprefixed 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
propertyFullNamestringThe original code element name.
Returns
- string
propertyFullNameprefixed 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
typeFullNamestringThe original code element name.
Returns
- string
typeFullNameprefixed 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
methodIMethodThis method.
returnTypeFullNamestringThe FullName of this method's return type.
The stringreturnTypeFullNamecan contain wildcard '' characters but cannot be just a single wildcard string "".
If one or several types are matched byreturnTypeFullName, this method has a returns any behavior.
Returns
- bool
returnType being a IType whose FullName is
returnTypeFullName:
Returns true ifmethodreturns 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