TryGetValue( ) method
- Last Updated: March 15, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Returns TRUE if a key object is found in the collection and the value object is returned as well via an output parameter, otherwise it returns FALSE. The key is found according to the equality comparer implementation (default or custom). Note that the implementation always uses the comparer when determining if the key can be found in the collection.
This method is provided to handle the case where the associated value may be the
Unknown value (?), and a distinction needs to be made between
retrieving a value that does exist but is unknown versus a situation where the key
is not present in the map at all.
Return type: LOGICAL
Access: PUBLIC
Applies to: Progress.Collections.HashMap<K,V> class
Syntax
|
- key
- The key to locate in the collection.
- value
- The value returned if the key is found.
The method raises an error if:
- The key object does not implement
Progress.Collections.IHashable, if using the default equality comparer implementation. - The key object is not a valid object reference (including the Unknown value
(
?)), if using the default equality comparer. - The equality comparer object specified via the specific constructor has become invalid.
- The custom equality comparer raises an error.