DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.8.0" />

 Reference

public static class Reference
Provides factory methods for creating references.
public static Reference<TValue> Allocate<TValue>(TValue value)

Allocates the memory location for the value and returns the reference to that location.

public static Reference<TValue> ArrayElement<TValue>(TValue[] array, IntPtr index)

Creates a reference to the array element.

public static Reference<TValue> Create<TValue>(method getter)

public static Reference<TValue> Create<TOwner, TValue>(TOwner owner, method getter)

public static Reference<TValue> Field<TValue>(StrongBox<TValue> box)

Creates a reference to the value stored in Value field.

public static Reference<TValue> FromPointer<TValue>(TValue* ptr) where TValue : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Converts the pointer to Reference<T>.

public static Reference<TValue> Unbox<TValue>(object boxed) where TValue : struct

Creates a reference to the boxed value.