Open sandboxFocus

Enum RefComparison

Defines strategies to compare two instances of the IRef<T> interface.

Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
public enum RefComparison
Remarks

References can be compared using different strategies depending on the scenario:

  • Use Default or IncludeNullability when comparing references within the same compilation. These strategies are faster but do not work across different compilation versions.
  • Use Structural or StructuralIncludeNullability when comparing references across different compilations. These strategies compare references by their structural identity (e.g., fully qualified name) rather than object identity.

For type references (IRef<T> where T is IType), the nullability variants consider nullable reference type annotations in the comparison.

Fields

Name Description
Default

Does not support cross-compilation comparisons and ignores nullability when comparing type references. This is the fastest comparison strategy and is suitable for comparing references within the same compilation.

IncludeNullability

Does not support cross-compilation comparisons and respects nullability when comparing type references. Use this strategy when nullable reference type annotations should affect equality.

Structural

Supports cross-compilation comparisons and ignores nullability when comparing type references. Use this strategy when comparing references from different compilation versions, such as when tracking declarations across aspect pipeline steps.

StructuralIncludeNullability

Supports cross-compilation comparisons and respects nullability when comparing type references. This is the most comprehensive comparison strategy, suitable for cross-compilation scenarios where nullable reference type annotations should affect equality.

See Also