Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
Parameters
list
Type: 'T listThe input list.
Return Value
The array containing the elements of the list.
Remarks
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.
Example
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|]
Platforms
Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2
Version Information
F# Runtime
Supported in: 2.0, 4.0
Silverlight
Supported in: 3