Class ExtensionMethodsCQLinqNaming
Presents extension methods to match code elements and members by name, through regular expressions.
public static class ExtensionMethodsCQLinqNaming
- Inheritance
-
ExtensionMethodsCQLinqNaming
- 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 regular expressions compilation step prior to query execution, that compiles once for all, specified regular expressions.
The user doesn't have to write this regular expressions compilation step. This results in less syntax burden.
For each of these extension methods, there are some corresponding methods in NDepend.CodeModel, that can be called to get the same action done.
This pre regular expression compilation step is weaved at CQLinq compilation time, the CQLinq compiler takes care of transforming calls to these extension methods adequately.
These extension methods cannot be called from a program consuming NDepend.API, since it would provoke regular expressions to be compiled for each code elements.
Methods (3)
FullNameLike(ICodeElement, string)
Returns true if this codeElement.FullName string matches the regular expression regexString. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsNaming.WithFullNameLike<TCodeElement>(IEnumerable<TCodeElement>, string) must be called instead.
public static bool FullNameLike(this ICodeElement codeElement, string regexString)
Parameters
codeElementICodeElementThis ICodeElement object.
regexStringstringThe regular expression is defined with the System.Text.RegularExpressions syntax.
The regular expression string can be suffixed with "\i" to specify the ignore case option.
Returns
Remarks
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 ExtensionMethodsNaming.WithFullNameLike<TCodeElement>(IEnumerable<TCodeElement>, string) must be called instead.
- See Also
NameLike(ICodeElement, string)
Returns true if this codeElement.Name string matches the regular expression regexString. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsNaming.WithNameLike<TCodeElement>(IEnumerable<TCodeElement>, string) must be called instead.
public static bool NameLike(this ICodeElement codeElement, string regexString)
Parameters
codeElementICodeElementThis ICodeElement object. A ICodeElement object can be a IAssembly, INamespace, IType, IMethod or IField object.
regexStringstringThe regular expression is defined with the System.Text.RegularExpressions syntax.
The regular expression string can be suffixed with "\i" to specify the ignore case option.
Returns
Remarks
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 ExtensionMethodsNaming.WithNameLike<TCodeElement>(IEnumerable<TCodeElement>, string) must be called instead.
- See Also
SimpleNameLike(ICodeElement, string)
Returns true if this codeElement.SimpleName string matches the regular expression regexString. This method can only be called in a ICQLinqExecutionContext, otherwise the extension method ExtensionMethodsNaming.WithFullNameLike<TCodeElement>(IEnumerable<TCodeElement>, string) must be called instead.
public static bool SimpleNameLike(this ICodeElement codeElement, string regexString)
Parameters
codeElementICodeElementThis ICodeElement object.
regexStringstringThe regular expression is defined with the System.Text.RegularExpressions syntax.
The regular expression string can be suffixed with "\i" to specify the ignore case option.
Returns
Remarks
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 ExtensionMethodsNaming.WithSimpleNameLike<TCodeElement>(IEnumerable<TCodeElement>, string) must be called instead.
- See Also