Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populate a Dictionary
Message
De
18/03/2011 13:59:03
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
18/03/2011 13:11:53
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01504070
Message ID:
01504147
Vues:
51
>>Try the following:
>>
Dictionary<string, string> MyDictionary = ds.Tables[0].AsEnumerable().ToDictionary(dr => dr["KeyName"].ToString(), dr => dr["KeyValue"].ToString());
Duh! Completely forgot about IEnumerable.ToDictionary() - and used it only yesterday :-{

I never knew that existed. Pretty sweet!
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform