public static CastArray<TFrom, TTo> Cast<TFrom, TTo>(
this TFrom[]? array
)
where TFrom : struct, new()
where TTo : struct, new()
<ExtensionAttribute>
Public Shared Function Cast(Of TFrom As {Structure, New}, TTo As {Structure, New}) (
array As TFrom()
) As CastArray(Of TFrom, TTo)
public:
[ExtensionAttribute]
generic<typename TFrom, typename TTo>
where TFrom : value class, gcnew()
where TTo : value class, gcnew()
static CastArray<TFrom, TTo> Cast(
array<TFrom>^ array
)
[<ExtensionAttribute>]
static member Cast :
array : 'TFrom[] -> CastArray<'TFrom, 'TTo> when 'TFrom : struct, new() when 'TTo : struct, new()
If the size of TTo cannot be divided by the size of TFrom, then the cast result may not cover the whole original array to prevent exceeding beyond the available buffer.