CastArrayTFrom, TToSlice(Int32, Int32) Method
Gets a new
CastArrayTFrom, TTo instance, which represents a subsection of the current instance with the specified
startIndex and
length.
Please note that the size of
TTo multiplied by
startIndex must be divisible by the size of
TFrom.
Namespace: KGySoft.CollectionsAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
public CastArray<TFrom, TTo> Slice(
int startIndex,
int length
)
Public Function Slice (
startIndex As Integer,
length As Integer
) As CastArray(Of TFrom, TTo)
public:
CastArray<TFrom, TTo> Slice(
int startIndex,
int length
)
member Slice :
startIndex : int *
length : int -> CastArray<'TFrom, 'TTo>
- startIndex Int32
- The offset that points to the first item of the returned section.
- length Int32
- The desired length of the returned section.
CastArrayTFrom,
TToThe subsection of the current
ArraySectionT instance with the specified
startIndex and
length.
If the size of
TTo multiplied by
startIndex is not divisible by the size of
TFrom,
then this method throws an
ArgumentException. If the targeted platform supports the
SpanT type and misaligned memory access,
then you can try to use the
AsSpan property and the
MemoryMarshal.Cast method.