Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populate a Dictionary
Message
De
23/03/2011 11:24:24
 
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:
01504681
Vues:
55
>>Whoah - this LINQ stuff is getting interesting - thanks very much for your help
>
>One final ( maybe ) question :-) - I have one routine which loops through a Columns collection of a DataTable and adds the column name as the K and the columns value as the V - could this be achieved with LINQ ? this is how I currently do it
>foreach(DataColumn dc in ds.Tables[0].Columns)
>    MyList.Add(dc.ToString(),ds.Tables[0].Rows[0][dc].ToString());
>

I'm not much of a LINQ expert, far from it ... I've barely used it. I think the above might not be do-able in LINQ, or if it is, probably not very straightforward. If I had a bit of free time, I might be able to play with it and see if I can make it work, but I'm not optimistic about that (both the free time *and* making it work! <g>) ... maybe someone who knows LINQ a good deal better than I can chime in on this question.

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform