Expand Minimize

List.toArray<'T> Function (F#)

Creates an array from the given list.

Namespace/Module Path: Microsoft.FSharp.Collections.List

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
List.toArray : 'T list -> 'T []

// Usage:
List.toArray list

list

Type: 'T list

The input list.

The array containing the elements of the list.

This function is named ToArray in compiled assemblies. If you are accessing the function from a .NET language other than F#, or through reflection, use this name.

The following code shows how to use List.toArray.

let array1 = [ 1; 3; -2; 4 ]
             |> List.toArray
Array.set array1 3 -10
Array.sortInPlaceWith (fun elem1 elem2 -> compare elem1 elem2) array1
printfn "%A" array1

Output

[|-10; -2; 1; 3|]

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft