ImmutableCollectionsMarshal.AsArray<T>(ImmutableArray<T>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈