Stongly typed collections

Bucky

Well-known member
Joined
Dec 23, 2001
Messages
791
Location
East Coast
User Rank
*Expert*
Ive been wondering, what is the advantage of a strongly-typed
collection (inheriting the CollectionBase and overriding the Add
method and the default property)? Is it:

a.) Easier to code with, because all the casting is done in the
Collection itself, and you get the advantage of IntelliSense and such,
b.) Increased runtime speed, because there isnt any boxing and
unboxing done to convert the types to and from an Object,
c.) Both, or
d.) Bucky, what are you smoking?

Now that I think about it, B seems a little ridiculous, since the
type is cast to and from an Object whether its done in a
strongly typed collection or if its done outside the collection.

Or maybe I have no idea what Im talking about. :)
 
From that article:

However, the advantages of a strongly typed collection
class include its ability to hold only instances of the type you
designate and to add custom functionality particular to the class
it holds. This ensures that the items in the collection can be
worked with efficiently, without having to cast to the correct type.

I understand now... that makes a lot of sense. Thanks.

So I guess the answer would be D, huh? :D
 
Back
Top