แก้ไข

แชร์ผ่าน


ImmutableCollectionsMarshal.AsArray<T>(ImmutableArray<T>) Method

Definition

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

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

Type Parameters

T

The type of elements in the input ImmutableArray<T> value.

Parameters

array
ImmutableArray<T>

The input ImmutableArray<T> value to get the underlying T array from.

Returns

T[]

The underlying T array for array, if present.

Remarks

When using this method, callers should make sure to not pass the resulting underlying array to methods that might mutate it. Doing so might cause undefined behavior in code paths using array that don't expect the contents of the ImmutableArray<T> value to change.

If array is uninitialized (that is, its IsDefault property is true), the resulting T array will be null.

Applies to