Map.ContainsKey<'Key,'Value> 메서드(F#)

요소가 맵의 도메인에 있는지 테스트합니다.

네임스페이스/모듈 경로:: Microsoft.FSharp.Collections

어셈블리: FSharp.Core(FSharp.Core.dll)

// Signature:
member this.ContainsKey : 'Key -> bool (requires comparison)

// Usage:
map.ContainsKey (key)

매개 변수

  • key
    형식: 'Key

    입력 키입니다.

반환 값

true지정된 키가 맵에 포함되어 있으면 True입니다.

예제

다음 코드는 ContainsKey 메서드를 사용하는 방법을 보여 줍니다.

let map1 = Map.ofList [ (1, "one"); (2, "two"); (3, "three") ]
let findKeyAndPrint key (map : Map<int,string>) =
    if (map.ContainsKey key) then
        printfn "The specified map contains the key %d." key
    else
        printfn "The specified map does not contain the key %d." key
findKeyAndPrint 1 map1
findKeyAndPrint 0 map1

Output

      

플랫폼

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.Map<'Key,'Value> 클래스(F#)

Microsoft.FSharp.Collections 네임스페이스(F#)