Skip to content

M_CodeJam_Collections_ArrayExtensions_ConvertAll__2

Andrew Koryavchenko edited this page Jun 17, 2018 · 7 revisions

ArrayExtensions.ConvertAll(TInput, TOutput) Method

Converts an array of one type to an array of another type.

Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static TOutput[] ConvertAll<TInput, TOutput>(
	this TInput[] array,
	Converter<TInput, TOutput> converter
)

VB

<ExtensionAttribute>
Public Shared Function ConvertAll(Of TInput, TOutput) ( 
	array As TInput(),
	converter As Converter(Of TInput, TOutput)
) As TOutput()

F#

[<ExtensionAttribute>]
static member ConvertAll : 
        array : 'TInput[] * 
        converter : Converter<'TInput, 'TOutput> -> 'TOutput[] 

Parameters

 

array
Type: TInput[]
The one-dimensional, zero-based Array to convert to a target type.
converter
Type: System.Converter(TInput, TOutput)
A Converter(TInput, TOutput) that converts each element from one type to another type.

Type Parameters

 

TInput
The type of the elements of the source array.
TOutput
The type of the elements of the target array.

Return Value

Type: TOutput[]
An array of the target type containing the converted elements from the source array.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . 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).

Exceptions

 

Exception Condition
ArgumentNullException array is null.-or-converter is null.

See Also

Reference

ArrayExtensions Class
CodeJam.Collections Namespace

Clone this wiki locally