Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding and removing items in collection
Message
De
27/10/2015 04:42:26
 
 
À
26/10/2015 15:14:04
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01626445
Message ID:
01626482
Vues:
42
>>From your code it looks as if the collection is actually a Dictionary of arrays.
>>But if that's the case I don't understand the "oInnerJoin.Add(loObject, lnKey, 1)" line - I'd expect
>>oInnerJoin.Add(lnKey,loObject);
>
>The key is the second parameter, not the first one.

But if oInnerJoin is
Dictionary<Tkey,TValue>
then the syntax for adding would be as my code above. That's why I didn't/don't understand your code :-{

>
>>IAC I would look in the collection and, if the key already exists then just modify the value. Only add it if is not already present.
>
>Yes, in this case, as it is an object, I can simply update the object as is, once I get a reference to it from the .Item() method.

So just? :
If loInnerJoin.ContainsKey(key) Then
	loInnerJoin(key) = value
Else
	loInnerJoin.Add(key, value)
End If
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform