ReadOnlySpan<T>.CastUp<TDerived> 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.
Casts a read-only span of TDerived
to a read-only span of T
.
public:
generic <typename TDerived>
where TDerived : class, T static ReadOnlySpan<T> CastUp(ReadOnlySpan<TDerived> items);
public static ReadOnlySpan<T> CastUp<TDerived> (ReadOnlySpan<TDerived> items) where TDerived : class, T;
static member CastUp : ReadOnlySpan<#'T> -> ReadOnlySpan<'T>
Public Shared Function CastUp(Of TDerived As {Class, T}) (items As ReadOnlySpan(Of TDerived)) As ReadOnlySpan(Of T)
Type Parameters
- TDerived
The element type of the source read-only span, which must be derived from T
.
Parameters
- items
- ReadOnlySpan<TDerived>
The source read-only span. No copy is made.
Returns
A read-only span with elements cast to the new type.
Remarks
This method uses a covariant cast, producing a read-only span that shares the same memory as the source. The relationships expressed in the type constraints ensure that the cast is a safe operation.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om