Collections.Map<'Key,'Value> クラス (F#)

変更できないマップ。 キーは、F# の汎用的な比較によって並べ替えられます。

名前空間/モジュール パス: Microsoft.FSharp.Collections

アセンブリ: FSharp.Core (FSharp.Core.dll 内)

[<Sealed>]
type Map<[<EqualityConditionalOnAttribute>] 'Key,[<ComparisonConditionalOnAttribute>] [<EqualityConditionalOnAttribute>] 'Value (requires comparison)> =
 class
  interface IEnumerable
  interface IComparable
  interface IEnumerable
  interface ICollection
  interface IDictionary
  new Map : seq<'Key * 'Value> -> Map< 'Key, 'Value>
  member this.Add : 'Key * 'Value -> Map<'Key, 'Value>
  member this.ContainsKey : 'Key -> bool
  member this.Remove : 'Key -> Map<'Key, 'Value>
  member this.TryFind : 'Key -> 'Value option
  member this.Count :  int
  member this.IsEmpty :  bool
  member this.Item ('Key) : 'Value
 end

解説

一般的な比較に基づくマップは、小さいキーの場合に効率的です。 キーが再帰的なデータ構造の場合、またはキーが特別な比較セマンティクスを必要とする場合には適していません。 このクラスのメンバーはすべてスレッド セーフであり、複数のスレッドから同時に使用できます。

この型は、コンパイルされたアセンブリでは FSharpMap という名前です。 F# 以外の言語、またはリフレクションを使用してこの型にアクセスする場合は、この名前を使用します。

コンストラクター

メンバー

説明

new

指定した IEnumerable<T> のバインディングを含むマップを作成します。

インスタンス メンバー

メンバー

説明

Add

指定されたマップにバインディングを追加した新しいマップを返します。

ContainsKey

要素がマップのドメイン内に存在するかどうかをテストします。

Count

マップ内のバインディングの数。

IsEmpty

マップ内にバインディングがない場合に true を返します。

Item

マップ内の要素を検索します。 マップ内にバインディングが存在しない場合は KeyNotFoundException を発生させます。

Remove

マップのドメインから要素を削除します。 要素が存在しない場合でも、例外は発生しません。

TryFind

マップ内の要素を検索し、要素がマップのドメイン内にある場合は Some 値を返し、そうでない場合は None を返します。

プラットフォーム

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

参照

その他の技術情報

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