tryGetValue
Function Signature
'key -> ^Dictionary -> ^value optionExamples
Example 1 — Key exists
open System.Collections.Generic
let dict = Dictionary<string, int>()
dict["apples"] <- 5
dict["bananas"] <- 3
let result : int option =
dict
|> Option.tryGetValue "apples"
// Some 5Example 2 — Key does not exist
Last updated