Szerkesztés

Megosztás a következőn keresztül:


ImmutableCollectionsMarshal.AsImmutableArray<T>(T[]) Method

Definition

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

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> AsImmutableArray(cli::array <T> ^ array);
public static System.Collections.Immutable.ImmutableArray<T> AsImmutableArray<T> (T[]? array);
static member AsImmutableArray : 'T[] -> System.Collections.Immutable.ImmutableArray<'T>
Public Shared Function AsImmutableArray(Of T) (array As T()) As ImmutableArray(Of T)

Type Parameters

T

The type of elements in the input array.

Parameters

array
T[]

The input array to wrap in the returned ImmutableArray<T> value.

Returns

An ImmutableArray<T> value wrapping array.

Remarks

When using this method, callers should take extra care to ensure that they're the sole owners of the input array, and that it won't be modified once the returned ImmutableArray<T> value starts being used. Doing so might cause undefined behavior in code paths that don't expect the contents of a given ImmutableArray<T> values to change after its creation.

If array is null, the returned ImmutableArray<T> value will be uninitialized (that is, its IsDefault property will be true).

Applies to