Hashtable

  • Thread starter Thread starter =?ISO-8859-1?Q?Bernard_Bour=E9e?=
  • Start date Start date
?

=?ISO-8859-1?Q?Bernard_Bour=E9e?=

I have a class named VALEUR which contains some properties like KEY and NAME

I have built a hashtable named VALEURS with a code like:
Valeurs.Add(Valeur.Key, Valeur)

in a loop I want to have access to the properties of each Valeur
I have tried

Dim Valeur as DictionaryEntry
For Each Valeur in Valeurs
na = Valeur.Name
next

But it does not work

Thanks for your help

Bernard
 
I have a class named VALEUR which contains some properties like KEY and NAME

I have built a hashtable named VALEURS with a code like:
Valeurs.Add(Valeur.Key, Valeur)

in a loop I want to have access to the properties of each Valeur
I have tried

Dim Valeur as DictionaryEntry
For Each Valeur in Valeurs
na = Valeur.Name
next

Dim entry As DictionaryEntry
For Each entry in Valeurs
Dim vl As Valeur = DirectCast (entry.Value, Valeur)
na = vl.Name
Next

You could probably shorten the loop body to:

na = DirectCast (entry.Value, Valeur).Name
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top