共用方式為


Array.fill<'T> 函式 (F#)

使用指定的值,填入某個範圍的陣列項目。

命名空間/模組路徑: Microsoft.FSharp.Collections.Array

組件:FSharp.Core (在 FSharp.Core.dll 中)

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

// Usage:
Array.fill target targetIndex count value

參數

  • target
    Type: 'T []

    目標陣列。

  • targetIndex
    型別:int

    要設定之第一個項目的索引。

  • count
    型別:int

    要設定的項目數目。

  • value
    型別:'T

    要設定的值。

備註

這個函式是名為 Fill中 已編譯的組件。 如果從一個語言,F # 以外,或透過反映存取函式使用這個名稱。

範例

下列範例示範使用 Array.fill覆寫部分的陣列 為零。

let arrayFill1 = [| 1 .. 25 |]
Array.fill arrayFill1 2 20 0
printfn "%A" arrayFill1
  

平台

Windows 7、Windows Vista SP2、Windows XP SP3、Windows XP x64 SP2、Windows Server 2008 R2、Windows Server 2008 SP2、Windows Server 2003 SP2

版本資訊

F# 執行階段

支援版本:2.0、4.0

Silverlight

支援版本:3

請參閱

參考

Collections.Array 模組 (F#)

Microsoft.FSharp.Collections 命名空間 (F#)