Share via


Array.blit<'T> Function (F#)

Reads a range of elements from the first array and writes them into the second.

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

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

// Signature:
Array.blit : 'T [] -> int -> 'T [] -> int -> int -> unit

// Usage:
Array.blit source sourceIndex target targetIndex count

Parameters

  • source
    Type: 'T []

    The source array.

  • sourceIndex
    Type: int

    The starting index of the source array.

  • target
    Type: 'T []

    The target array.

  • targetIndex
    Type: int

    The starting index of the target array.

  • count
    Type: int

    The number of elements to copy.

Remarks

This function is named CopyTo 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 example illustrates the use of Array.blit.

let array1 = [| 1 .. 10 |]
let array2 = Array.zeroCreate 20
// Copy 4 elements from index 3 of array1 to index 5 of array2.
Array.blit array1 3 array2 5 4
printfn "%A" array2

Output

[|0; 0; 0; 0; 0; 4; 5; 6; 7; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|]

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

See Also

Reference

Collections.Array Module (F#)

Microsoft.FSharp.Collections Namespace (F#)