473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

hashTable.RemoveAll

So what is the best way to iterate through the hash table to remove all the
members?

i tried using the enumerator but it gets an exception as it removes each
element.

dim de as dictionaryEntry
for each de in xHashTable
xHashTable.remove(de.key)
next

I am missing the vb6 scripting.dictionary.removeall.

Thanks,
jeff
Nov 20 '05 #1
3 1471
Ot
Isn't there a clear() method? xHashTable.clear

There is no real need to remove as you go through and process each.

"msnews.microsoft.com" <je******************@verizon.net> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...
So what is the best way to iterate through the hash table to remove all the members?

i tried using the enumerator but it gets an exception as it removes each
element.

dim de as dictionaryEntry
for each de in xHashTable
xHashTable.remove(de.key)
next

I am missing the vb6 scripting.dictionary.removeall.

Thanks,
jeff

Nov 20 '05 #2
* "msnews.microsoft.com" <je******************@verizon.net> scripsit:
So what is the best way to iterate through the hash table to remove all the
members?


Call the hashtable's 'Clear' method. You cannot manipulate the
hashtable when enumerating it with 'For...Each'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
..clear is it. Thanks.

"Ot" <ur***@tds.invalid (use net)> wrote in message
news:#C**************@TK2MSFTNGP09.phx.gbl...
Isn't there a clear() method? xHashTable.clear

There is no real need to remove as you go through and process each.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sam | last post by:
I am attempting to remove a full node. XML Example: <Videos> <Video> <Name>Crocodile Dundee 2</Name> <Media>DVD</Media> </Video> <Video> <Name>Terminator 6</Name> <Media>DVD</Media>
5
by: francois | last post by:
First of all I would to to apologize for resending this post again but I feel like my last post as been spoiled Here I go for my problem: Hi, I have a webservice that I am using and I would...
33
by: Ken | last post by:
I have a C# Program where multiple threads will operate on a same Hashtable. This Hashtable is synchronized by using Hashtable.Synchronized(myHashtable) method, so no further Lock statements are...
3
by: Fred | last post by:
I'm trying to build a hashtable and a arraylist as object value I'm not able to retrieve stored object from the hashtable. Hashtable mp = new Hashtable(); // THE HASHTABLE ArrayList...
0
by: hn | last post by:
Hi, I just want to confirm my understanding of Session.RemoveAll. Session.RemoveAll is used to remove all the session contents of that PARTICULAR SESSION, ie. of that particular user, is that...
1
by: Guadala Harry | last post by:
I store a few things in my app's Application state. Sometimes I need to change them, so I have been calling Application.RemoveAll() using the following line, and then re-inserting my variables with...
2
by: PAzevedo | last post by:
I have this Hashtable of Hashtables, and I'm accessing this object from multiple threads, now the Hashtable object is thread safe for reading, but not for writing, so I lock the object every time I...
1
by: Nathan Sokalski | last post by:
Is there a difference between Session.Clear() and Session.RemoveAll()? The descriptions and documentation pages seem to say exactly the same thing, but I am assuming there must be some reason for...
5
by: Jen | last post by:
The usual trick to get around the "collection was modified" problem by looping through the collection backwards by index won't work with a Hashtable because there is no way to access by index,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.