Map.containsKey<'Key,'T> 함수(F#)
요소가 맵의 도메인에 있는지 테스트합니다.
네임스페이스/모듈 경로: Microsoft.FSharp.Collections.Map
어셈블리: FSharp.Core(FSharp.Core.dll)
// Signature:
Map.containsKey : 'Key -> Map<'Key,'T> -> bool (requires comparison)
// Usage:
Map.containsKey key table
매개 변수
key
형식: 'Key입력 키입니다.
table
형식: Map<'Key,'T>입력 맵입니다.
반환 값
맵에 키가 포함되어 있으면 true입니다.
설명
컴파일된 어셈블리에서 이 함수의 이름은 ContainsKey입니다. F# 이외의 언어에서 함수에 액세스하거나 리플렉션을 통해 함수에 액세스하는 경우 이 이름을 사용합니다.
예제
다음 코드에서는 Map.containsKey을 사용하는 방법을 보여 줍니다.
let map1 = Map.ofList [ (1, "one"); (2, "two"); (3, "three") ]
let findKeyAndPrint key map =
if (Map.containsKey key map) 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