Open sandboxFocus

Property IsRef

IsRef

Gets or sets a value indicating whether the type is declared with the ref modifier, which makes it a type that may live on the stack only.

Declaration
bool IsRef { get; set; }
Property Value
Type Description
bool
Remarks

The language allows the ref modifier on a struct that is not a record. The setter throws an InvalidOperationException in any other case.

A ref struct may not be used as a type argument, may not be a field of a type that is not itself a ref struct, and may not be boxed. Metalama does not verify those restrictions on the code that an aspect generates, so the compiler reports them on the generated code.