Open sandboxFocus

Method ForCompilation

ForCompilation<T>(T?, ICompilation)

Gets a representation of the current declaration in a different version of the compilation.

Declaration
public static T? ForCompilation<T>(this T? compilationElement, ICompilation compilation) where T : class, ICompilationElement
Parameters
Type Name Description
T compilationElement

The compilation element to translate.

ICompilation compilation

The target compilation.

Returns
Type Description
T

The compilation element in the context of the target compilation.

Type Parameters
Name Description
T

The type of compilation element.

Exceptions
Type Condition
InvalidOperationException

The declaration does not exist in the requested compilation. Use TryForCompilation<T>(T?, ICompilation, out T?) to avoid this exception.