ImmutableArray<T>.As<TOther> Method
Definition
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)
Type Parameters
- TOther
The type of array element to return.
Returns
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
.
Remarks
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.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기