ImmutableArray<T>.As<TOther> Metoda

Definicja

Zwraca nową niezmienną tablicę zawierającą elementy tej tablicy rzutowanej na inny typ.

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)

Parametry typu

TOther

Typ elementu tablicy do zwrócenia.

Zwraca

ImmutableArray<TOther>

Niezmienna tablica zawierająca elementy tej tablicy rzutowania na inny typ. Jeśli rzutowanie nie powiedzie się, zwraca tablicę, której IsDefault właściwość zwraca wartość true.

Uwagi

Tablice typów elementów pochodnych można rzutować na tablice typów elementów podstawowych bez reallokowania tablicy.

Upcasts elementu utworzonego za Create pomocą metody można cofnąć przy użyciu As metody . Jednak downcast jest pomyślny tylko wtedy, gdy odwraca poprzedni upcast. .

Dotyczy