Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Enumerate a SortedList
Message
De
31/01/2009 10:47:13
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
À
31/01/2009 09:59:23
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01378599
Message ID:
01378600
Vues:
10
>I have a sorted list defined as follows: (Note Less/Greater than sign = () )
>
>public SortedList(string, Contro) DataControls = new SortedList(string, Control)();
>
>I want to enumerate that list like this:
>
>foreach(SomeType DataCtrl in DataControls)
>
>{
> string cType = DataCtrl.Value.GetType().Name;
>
> switch (cType)
> {
> case "TextBox":
> //do Somthing
> break;
> case next...
> }
>}
>
>My problem is not knowing the the SomeType. I've tried the following defintion:
>
>public IDictionary DataControls = new SortedList(string, Control)();
>
>And then using the DictionaryEntry type, but then I lose some functionality of the SortedList that I need in other places in the code.
>
>Ideas are welcome...I just want to enumerate this list.
>
>Thanks.
>
>bob


Off the top of my head, you probably could use:

for(Control sometype ...

or

for(Object sometype...



John
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform