Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
2 dictionary collections
Message
 
 
À
28/09/2016 11:33:54
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01641447
Message ID:
01641454
Vues:
55
>>>>Thanks a lot in advance.
>>>
>>>
>>>prefsRetailViewModel.AvailableTrackingColumns = this.trackingLookupOrderColumns.Keys.Except(prefsRetailViewModel.Keys);
>>
>>This is close, but also not working. The AvailableTrackingColumns is also a Dictionary, so I need to get them with the values. If I can get a list of keys with the above method, can I then somehow grab that portion of the Dictionary (using these keys) in one simple call?
>>
>>I can, of course, just iterate through keys, but I wanted to use LINQ capabilities and I'm sure there is some smart way of grabbing the relevant dictionary entries.
>
>
>something along this line (not tested):
>
>
>var result = newDic
>    .Where(kvp => !oldDic.ContainsKey(kvp.Key))
>    .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
>
Got it compiled, thanks a lot. Going to test now.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform