<PackageReference Include="System.Collections.Immutable" Version="11.0.0-preview.5.26302.115" />

System.Runtime.InteropServices.ImmutableCollectionsMarshal

public static class ImmutableCollectionsMarshal
An unsafe class that provides a set of methods to access the underlying data representations of immutable collections.
public static T[] AsArray<T>(ImmutableArray<T> array)

Gets the underlying T array for an input ImmutableArray<T> value.

public static ImmutableArray<T> AsImmutableArray<T>(T[] array)

Gets an ImmutableArray<T> value wrapping the input T array.

public static Memory<T> AsMemory<T>(Builder<T> builder)