ImmutableArray<T>.As<TOther> 方法

定義

傳回新的不可變數組,其中包含這個數位的項目轉換成不同的類型。

public:
generic <typename TOther>
 where TOther : class System::Collections::Immutable::ImmutableArray<TOther> As();
public System.Collections.Immutable.ImmutableArray<TOther> As<TOther>() where TOther : class;
member this.As : unit -> System.Collections.Immutable.ImmutableArray<'Other (requires 'Other : null)> (requires 'Other : null)
Public Function As(Of TOther As Class) () As ImmutableArray(Of TOther)

類型參數

TOther

要回傳的陣列元素類型。

傳回

ImmutableArray<TOther>

一個不可變陣列,包含該陣列的元素,並被鑄造成不同型別。 若鑄造失敗,回傳一個陣列,其 IsDefault 性質 true為 。

備註

衍生元素類型的陣列可以直接鑄造為基礎元素類型的陣列,而無需重新配置陣列。

使用此方法所產生 Create 的元素上移可被反轉 As 。 然而,下沉只有在逆轉之前的下落時才算成功。 操作。

適用於