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.
Sets an element of an array.
Namespace/Module Path: Microsoft.FSharp.Collections.Array
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
Array.set : 'T [] -> int -> 'T -> unit
// Usage:
Array.set array index value
Parameters
Remarks
This function is named Set in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.
Example
The following code illustrates creating, setting and getting array values.
let array1 = Array.create 10 ""
for i in 0 .. array1.Length - 1 do
Array.set array1 i (i.ToString())
for i in 0 .. array1.Length - 1 do
printf "%s " (Array.get array1 i)
0 1 2 3 4 5 6 7 8 9
Platforms
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
Version Information
F# Core Library Versions
Supported in: 2.0, 4.0, Portable