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 メソッドを使用して元に戻すことができます。 ただし、ダウンキャストは、前のアップキャストを逆にした場合にのみ成功します。 操作を完了するための次の手順について引き続き調査中です。

適用対象