Collection Classes

  • Thread starter Thread starter Kevin Phifer
  • Start date Start date
K

Kevin Phifer

I'm converting over to .net via c# from vb6. There was
this great article called the house of bricks that showed
you how to create a strongly typed collection class.
In .net I have found the CollectionBase and DictionaryBase
that I can create these from, but I also noted that I can
support the IEnum's as well using something like an
ArrayList to store the data.

What I would like to know is, is there another article out
there like House of Bricks that can give me the pitfalls
of which way to create strongly typed collection type
classes?

or what is the "best" way to do this.

Thanx in advance....
 
I'm converting over to .net via c# from vb6. There was
this great article called the house of bricks that showed
you how to create a strongly typed collection class.
In .net I have found the CollectionBase and DictionaryBase
that I can create these from, but I also noted that I can
support the IEnum's as well using something like an
ArrayList to store the data.

What I would like to know is, is there another article out
there like House of Bricks that can give me the pitfalls
of which way to create strongly typed collection type
classes?

or what is the "best" way to do this.

I've created a simple collection generator and some templates. Each has
a short description of their purpose...

http://sourceforge.net/projects/colcodegen

One of them inherits from CollectionBase and implements IDictionary.
Know that CollectionBase already implements IEnumerable, IList, and
ICollection.

IList is a really important one if you want your collection to be
bindable to a DataGrid.

Also here is an article that creates a new collection type implementing
IDictionary and IEnumerable only:

http://www.codeproject.com/csharp/hashlistarticle.asp

Overall, for replicating the VB6 collection just inherit from
CollectionBase and add an internal HashTable for storing by key in
addition to by index (CollectionBase). THe templates on my open source
project site do this.

Michael Lang, MCSD
 
Back
Top