SpanExtensions.ToArray<T, U> Method

Applies a function to the elements of a span and returns the result as an array.

Definition

Namespace: Numerics.NET.Collections
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
public static U[] ToArray<T, U>(
	this ReadOnlySpan<T> span,
	Func<T, U> function
)

Parameters

span  ReadOnlySpan<T>
A read-only span.
function  Func<T, U>
A function to apply to each element of span.

Type Parameters

T
The type of the elements of the span.
U
The type of the elements of the result.

Return Value

U[]
An array containing the result of applying function to each element of span.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also