Reputation: 10507
Why is the Collection
in the Microsoft.VisualBasic
library? Why is it not in a more general location. Is there a reason Microsoft "hid" it from C#?
Upvotes: 5
Views: 199
Reputation: 15071
The Collection
in the Microsoft.VisualBasic library is a throw-back to the older VB6 Collection.
There is a System.Collection
namespace that you should probably look into for the basic .NET collection functionality you probably want.
Also, it's kind of worth mentioning that you CAN add a reference and make use of the System.VisualBasic namespace in your C# code. It's just that, most of the time, there isn't any need to do it (example: http://msdn.microsoft.com/en-us/library/ms173136.aspx).
EDIT - Updated namespace - sorry!
Upvotes: 7
Reputation: 43743
It is intended for backwards compatibility with VB6. You should not use it, if possible, for new code. List(Of T)
would be the preferred general purpose collection.
Upvotes: 2
Reputation: 6850
It's a functional equivalent to the Collection
class from VB6. It's there just to ease porting of VB6 code; for anything new you should use the normal .NET collection classes.
Upvotes: 1