Interface IRef<T>
Represents a reference to a declaration that can be resolved using GetTarget(ICompilation, ReferenceResolutionOptions), given an compilation, or using the GetTarget<T>(IRef<T>, ReferenceResolutionOptions) extension method for the compilation of the current context.
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IRef<out T>
where T : class, ICompilationElement
Type Parameters
Name | Description |
---|---|
T | The type of the target object of the declaration. |
Methods
Name | Description |
---|---|
GetTarget(ICompilation, ReferenceResolutionOptions) | Gets the target of the reference for a given compilation, or throws an exception if the reference cannot be resolved. To get the reference for the current execution context, use the GetTargetOrNull<T>(IRef<T>, ReferenceResolutionOptions) extension method. |
GetTargetOrNull(ICompilation, ReferenceResolutionOptions) | Gets the target of the reference for a given compilation, or returns |
ToSerializableId() | Returns a string that uniquely identifies the declaration represented by the current reference. This identifier can then be resolved using Metalama.Framework.Code.IDeclarationFactory.GetDeclarationFromId(Metalama.Framework.Code.SerializableDeclarationId), even in a different process or with a different version of Metalama than the one that created the id. |