Table of Contents

Class ExtensionMethodsCQLinqCompare

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

Presents extension methods on code elements, that provide a syntax friendly way to specify diff actions in CQLinq rules queries.

public static class ExtensionMethodsCQLinqCompare
Inheritance
ExtensionMethodsCQLinqCompare
Inherited Members

Remarks

These extension methods exist for CQLinq friendly syntax reasons and can only be called in a ICQLinqExecutionContext.
Indeed they all rely on a hidden ICompareContext object, hidden in CQLinq queries. This results in less syntax burden.
At CQLinq compilation time, the CQLinq compiler takes care of transforming calls to these extension methods into calls to methods of a ICompareContext object.
Indeed each of these extension methods, has an equivalent method defined by ICompareContext, that can be called from a program that consumes NDepend.API.

Methods (15)

BecameObsolete(IMember)

Returns true if this member is not tagged with System.ObsoleteAttribute in the older version of the code base, but is tagged as obsolete in the newer version of the code base. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.BecameObsolete(IMember) must be called instead.

public static bool BecameObsolete(this IMember member)

Parameters

member IMember

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

Returns

bool

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 ICompareContext.BecameObsolete(IMember) must be called instead.

CodeWasChanged(ICodeContainer)

Returns true if the code of this codeContainer object, has been modified. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.CodeWasChanged(ICodeContainer) must be called instead.

public static bool CodeWasChanged(this ICodeContainer codeContainer)

Parameters

codeContainer ICodeContainer

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

Returns

bool

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 ICompareContext.CodeWasChanged(ICodeContainer) must be called instead.

CommentsWereChanged(ICodeContainer)

Returns true if comments of this codeContainer object, have been modified. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.CommentsWereChanged(ICodeContainer) must be called instead.

public static bool CommentsWereChanged(this ICodeContainer codeContainer)

Parameters

codeContainer ICodeContainer

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

Returns

bool

Remarks

So far, comments change is detected only when ICodeContainer.NbLinesOfComment has been changed.
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 ICompareContext.CommentsWereChanged(ICodeContainer) must be called instead.

IsInNewerBuild(ICodeElement)

Returns true if this codeElement object is in the newer version of the code base. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.IsInNewerBuild(ICodeElement) must be called instead.

public static bool IsInNewerBuild(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

This ICodeElement object. A ICodeElement object can be a ICodeElement or a ICodeBase object.

Returns

bool

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 ICompareContext.IsInNewerBuild(ICodeElement) must be called instead.

IsInOlderBuild(ICodeElement)

Returns true if this codeElement object is in the older version of the code base. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.IsInOlderBuild(ICodeElement) must be called instead.

public static bool IsInOlderBuild(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

This ICodeElement object. A ICodeElement object can be a ICodeElement or a ICodeBase object.

Returns

bool

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 ICompareContext.IsInOlderBuild(ICodeElement) must be called instead.

IsNotUsedAnymore(ICodeElement)

Returns true if this codeElement object is in a third-party assembly (or is a third-party assembly itself), and if it is used by the older version of the code base, but not by the newer version. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.IsNotUsedAnymore(ICodeElement) must be called instead.

public static bool IsNotUsedAnymore(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

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

Returns

bool

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 ICompareContext.IsNotUsedAnymore(ICodeElement) must be called instead.

IsPresentInBothBuilds(ICodeElement)

Returns true if this codeElement object is both in the newer and older versions of the code base. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.IsPresentInBothBuilds(ICodeElement) must be called instead.

public static bool IsPresentInBothBuilds(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

This ICodeElement object. A ICodeElement object can be a ICodeElement or a ICodeBase object.

Returns

bool

Remarks

If this method returns true, this means that this code element has not been added nor removed.
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 ICompareContext.IsPresentInBothBuilds(ICodeElement) must be called instead.

IsUsedDifferently(ICodeElementParent)

Returns true if this codeElementParent is a namespace or a type in a third-party assembly (or is a third-party assembly itself) and if some of its children code elements are not used anymore by the newer version of the code base, or are used by the newer version of the code base, but are not used by the older version. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.IsUsedDifferently(ICodeElementParent) must be called instead.

public static bool IsUsedDifferently(this ICodeElementParent codeElementParent)

Parameters

codeElementParent ICodeElementParent

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

Returns

bool

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 ICompareContext.IsUsedDifferently(ICodeElementParent) must be called instead.

IsUsedRecently(ICodeElement)

Returns true if this codeElement object is in a third-party assembly (or is a third-party assembly itself), and if it is used by the newer version of the code base, but not by the older version. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.IsUsedRecently(ICodeElement) must be called instead.

public static bool IsUsedRecently(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

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

Returns

bool

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 ICompareContext.IsUsedRecently(ICodeElement) must be called instead.

NewerVersion<T>(T)

Returns the newer version of this codeElement object. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.NewerVersion<T>(T) must be called instead.

public static T NewerVersion<T>(this T codeElement) where T : class, ICodeElement

Parameters

codeElement T

This ICodeElement object. A ICodeElement object can be a ICodeElement or a ICodeBase object.

Returns

T

Type Parameters

T

T is the closed ICodeElement generic type, like in ICodeElement<IMethod> or ICodeElement<ICodeBase> for example.

Remarks

If this code element is already the newer version, returns this code element.
If this code element has been removed and has no corresponding newer version, returns null.
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 ICompareContext.NewerVersion<T>(T) must be called instead.

OlderVersion<T>(T)

Returns the older version of this codeElement object. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.OlderVersion<T>(T) must be called instead.

public static T OlderVersion<T>(this T codeElement) where T : class, ICodeElement

Parameters

codeElement T

This ICodeElement object. A ICodeElement object can be a ICodeElement or a ICodeBase object.

Returns

T

Type Parameters

T

T is the closed ICodeElement generic type, like in ICodeElement<IMethod> or ICodeElement<ICodeBase> for example.

Remarks

If this code element is already the older version, returns this code element.
If this code element has been added and has no corresponding older version, returns null.
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 ICompareContext.OlderVersion<T>(T) must be called instead.

VisibilityWasChanged(IMember)

Returns true if the visibility of this member has been changed. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.VisibilityWasChanged(IMember) must be called instead.

public static bool VisibilityWasChanged(this IMember member)

Parameters

member IMember

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

Returns

bool

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 ICompareContext.VisibilityWasChanged(IMember) must be called instead.

WasAdded(ICodeElement)

Returns true if this codeElement object has been added and thus, is not present in the older version of the code base. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.WasAdded(ICodeElement) must be called instead.

public static bool WasAdded(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

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

Returns

bool

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 ICompareContext.WasAdded(ICodeElement) must be called instead.

WasChanged(ICodeElement)

Returns true if this codeElement object was changed in any way (code change, comment change, visibility change...). This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.WasChanged(ICodeElement) must be called instead.

public static bool WasChanged(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

This ICodeElement object. A ICodeElement object can be a ICodeElement or a ICodeBase object.

Returns

bool

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 ICompareContext.WasChanged(ICodeElement) must be called instead.

WasRemoved(ICodeElement)

Returns true if this codeElement object has been removed and thus, is not present in the newer version of the code base. This method can only be called in a ICQLinqExecutionContext, otherwise the method ICompareContext.WasRemoved(ICodeElement) must be called instead.

public static bool WasRemoved(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

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

Returns

bool

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 ICompareContext.WasRemoved(ICodeElement) must be called instead.

See Also