Collection Object Preferred

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,

Just a general question. Is the Collection Object a dinosaur from VB6 with
another more useful object preferred for VB.NET? Or, has its stature remained
unchanged with .NET?

Thanks in advance!
Jack
 
Hi Jack,

That Collection class is provided for backwards compatibility, but in .NET
it is better to search a more suitable class or build your own derived from
some of the several bases to do that.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
Jack said:
Just a general question. Is the Collection Object a dinosaur from VB6 with
another more useful object preferred for VB.NET? Or, has its stature
remained
unchanged with .NET?

You can use it whenever it's use is appropriate. However, notice that this
class is not serializable.
 
Jack,

I wished that they had placed this class in the backwards compatibility
namespace however it is still in the normal visual.basic namespace.

The same as all the MS-VB functions uses this the One starting indexer
instead from the Zero starting indexer. Although that Zero starting indexer
is a very good idea, is it nowhere accepted and all other arrays and
collections in .Net use therefore the Zero as start point for the index.

I avoid it because of that, it is very confusing.

Just my thought about it.

Cor
 
doh,
Although that Zero starting indexer is a very good idea, is it nowhere
accepted and all other arrays and Although that First starting indexer is a
very good ....................................

Cor
 
Murphys law second time wrong

">>Although that Zero starting indexer is a very good idea, is it nowhere
Although that First starting indexer is a very good
.....................................

Cor
 
Jack,
In addition to the other comments.

The VB.Collection class is a very generalized collection.

While the collection classes in System.Collections &
System.Collections.Specialized are specialized collection classes.

I normally favor type safe collections that inherit from DictionaryBase or
CollectionBase (extremely specialized collections).

The other "problem" with with VB.Collection is as Cor suggests that it uses
base 1 offsets, while all other .NET collections use base 0 offsets, this
can cause subtle "off by 1" bugs in your code.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top