Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding and removing items in collection
Message
From
27/10/2015 12:02:45
 
 
To
27/10/2015 11:33:17
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01626445
Message ID:
01626511
Views:
36
>>Ahhh - sorry, that collection is specific to VB.NET in the Microsoft.VisualBasic namespace. Didn't know it existed.
>>
>>Since most of the stuff in there was written for compatibility with the old VB6 you might be better off using the .NET generic options (such as the Dictionary I assumed you were using)
>
>I use it somewhere. For basic stuff, I rely on the standard collection.

Doesn't look like it's the most useful in this case since, AFAICS, you can only get a read only value from the collection:
https://msdn.microsoft.com/en-us/library/h0fzzwyh(v=vs.110).aspx

Which means you are stuck with the Add/Remove option.

Also on https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.collection(v=vs.110).aspx :

"Whenever possible, you should use the generic collections in the System.Collections.Generic namespace or the System.Collections.Concurrent namespace instead of a Visual Basic Collection. For more information, see Collections (C# and Visual Basic)."

and:

"Iterating through a Visual Basic Collection is not a thread-safe procedure. Even if the collection is synchronized, other threads can still modify the collection, causing the enumerator to throw an exception. To guarantee thread safety during enumeration, either lock the collection or catch the exceptions resulting from changes made by other threads. For more information on locking a programming element, see SyncLock Statement."

If your collection is accessible from other web hits that might explain the problem you are seeing ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform