/** * m_hash_table_foreach: * @hash_table: a #MHashTable. * @func: the function to call for each key/value pair. * @user_data: user data to pass to the function. * * Calls the given function for each of the key/value pairs in the * #MHashTable. The function is passed the key and value of each * pair, and the given @user_data parameter. The hash table may not * be modified while iterating over it (you can't add/remove * items). To remove all items matching a predicate, use * m_hash_table_foreach_remove(). * * See m_hash_table_find() for performance caveats for linear * order searches in contrast to m_hash_table_lookup(). **/ public void Foreach(MHFunc func, IntPtr user_data) { if (func == null) { throw new ArgumentNullException("func"); } for (int i = 0; i < size; i++) { MHashNode *node = &nodes [i]; if (node->key_hash > 1) { func(node->key, node->value, user_data); } } }
/** * m_hash_table_foreach: * @hash_table: a #MHashTable. * @func: the function to call for each key/value pair. * @user_data: user data to pass to the function. * * Calls the given function for each of the key/value pairs in the * #MHashTable. The function is passed the key and value of each * pair, and the given @user_data parameter. The hash table may not * be modified while iterating over it (you can't add/remove * items). To remove all items matching a predicate, use * m_hash_table_foreach_remove(). * * See m_hash_table_find() for performance caveats for linear * order searches in contrast to m_hash_table_lookup(). **/ public void Foreach(MHFunc func, IntPtr user_data) { if (func == null) throw new ArgumentNullException ("func"); for (int i = 0; i < size; i++) { MHashNode *node = &nodes [i]; if (node->key_hash > 1) func (node->key, node->value, user_data); } }