Map.Add<'Key,'Value> 方法 (F#)
傳回新對應,這個對應的繫結已加入至指定的對應。
**命名空間/模組路徑:**Microsoft.FSharp.Collections
組件:FSharp.Core (在 FSharp.Core.dll 中)
// Signature:
member this.Add : 'Key * 'Value -> Map<'Key, 'Value> (requires comparison)
// Usage:
map.Add (key, value)
參數
key
型別:'Key輸入索引鍵。
value
型別:'Value輸入值。
傳回值
產生的對應。
範例
下列程式碼範例顯示如何使用 Add 方法。
let map1 = Map.ofList [ (1, "one"); (2, "two"); (3, "three") ]
let map2 = map1.Add(0, "zero")
map2 |> Map.iter (fun key value -> printfn "key: %d value: %s" key value)
Output
平台
Windows 8 中, Windows 7, Windows Server 2012 上, Windows Server 2008 R2
版本資訊
F# 核心程式庫版本
支援版本:2.0, 4.0,可攜式執行檔 (PE)。