This topic provides code samples of how to work with dictionaries.
-
Gets the number of key/value pairs
myCount = myDictionary.Count
-
Gets a collection of all dictionary keys
myKeys = myDictionary.Keys
-
Gets a collection of all dictionary values
myValues = myDictionary.Values
-
Removes all key/value pairs from the dictionary
Clear()
-
Checks if the dictionary contains the value 2345 and returns true or false
ContainsValue(2345)
-
Tries to get the value of the key "V12" and returns true or false
TryGetValue("V12", value)
-
Tries to add the key/value pair "V13", 3456 and returns true or false
TryAdd("V13", 3456)