ImmutableArray<T>.As<TOther> Method
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.
Returns a new immutable array that contains the elements of this array cast to a different type.
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
The type of array element to return.
An immutable array that contains the elements of this array, cast to a different type. If the cast fails, returns an array whose IsDefault property returns true
.
Arrays of derived elements types can be cast to arrays of base element types without reallocating the array.
Upcasts of element created with the Create method can be reversed using the As method. However, a downcast is only successful when it reverses a prior upcast. operation.
Termék | Verziók |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
UWP | 10.0 |
.NET-visszajelzés
A(z) .NET egy nyílt forráskód projekt. Visszajelzés adásához válasszon egy hivatkozást: