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 。 不過,只有在還原先前的上播時,下播才會成功。 事件。

適用於