Collection - CalculateHash Method

CalculateHash calculates a hash value

Member of Collection (PRIM_COLL)


NameTypeData TypeDescription
Result*Result (Optional)IntegerResulting number
Value*InputVariantValue to hash


Use the CalculateHash method to calculate a hash value.
Hash values are used by the collection in order to obtain a hash that will always identify a component. Using the hash, only those components in the collection with the same hash are checked for equality. The default hash is the pointer to the component.
There may be situations where you want to be able to look up in dictionary based on a value like a name or identifier. To obtain a hash for these kinds of values use the CalculateHash method during the Hash event supplying the value(s) that you want hashed
Note that a hash event is only used by unordered collections (Set and Dictionary) that need to be able to do lookups quickly when there could be a large number of items in the collection.
Other collections do lookups using the Compare event as a means to sort the items.
Ordered collections do lookups by searching through the collection looking for a match. These collections use the IsEqual event and include the List and Array collection classes.


Using the CalculateHash method. The Hash event is fired whenever the collection needs to evaluate a hash.
Evtroutine Handling(#Collection.Hash) Subject(#Subject) Hash(#Hash)
   #Hash := #Collection.CalculateHash(#Subject)


See also

All Component Classes

Technical Reference

Febuary 18 V14SP2