Open sandboxFocus

Interface IRef<T>

Represents a strongly-typed reference to an IDeclaration or IType that remains valid across different compilation versions (i.e., ICompilation) and, when serialized, across projects and processes.

Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
public interface IRef<out T> : IRef, IEquatable<IRef> where T : class, ICompilationElement
Type Parameters
Name Description
T

The type of the target object, such as IMethod, IProperty, INamedType, or any other ICompilationElement.

Remarks

This is the strongly-typed variant of IRef. To obtain a reference, call ToRef() or the type-specific ToRef() method on any declaration interface. To resolve a reference back to the declaration in a specific compilation, use GetTarget<T>(IRef<T>, ICompilation, IGenericContext?) or GetTarget<T>(IRef<T>) (for the current execution context).

Use RefEqualityComparer<T> to compare instances of IRef<T> in collections.

Extension Methods

See Also