473,320 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Collectionbase with key

Hi,
I've begun trying out the .NET2005 beta and one thing that I was thrilled
about in advance was the CollectionBase class. No more selfmade Collection
classes I thought.
But now I'm puzzled, I can't have a Collection class based on the
CollectionBase that accepts strings as key? It only accepts integers!
Why would I use a CollectionBase class as the base class of my collection if
it can't have a string as it's key?
Why not stick to the old way and have an internal
Collection/Hashtable/ListDictionary/WhatEver as holder for your objects ?

Should I make a suggestion to MS?

Regards
/Kejpa
Nov 21 '05 #1
4 1618
Kejpa,

VBNet 2005 is a beta product, any comments on found problems can be
discussed in this newsgroups.

http://communities.microsoft.com/new...idbey&slcid=us

I hope this helps?

Cor
Nov 21 '05 #2
I guessed there was a more approprite place but I couldn't find it.

Thanx for redirecting me ;)

/Kejpa

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Kejpa,

VBNet 2005 is a beta product, any comments on found problems can be
discussed in this newsgroups.

http://communities.microsoft.com/new...idbey&slcid=us
I hope this helps?

Cor

Nov 21 '05 #3
Kejpa,
CollectionBase has been in the framework since VS.NET 2002. It is used to
create type safe collections that are indexed by Integers.

If you want a type safe collection that are index by Strings or other object
I would recommend DictionaryBase.

Hope this helps
Jay

"Kejpa" <kS*******@saj.fi> wrote in message
news:cm**********@gandalf.alcom.aland.fi...
Hi,
I've begun trying out the .NET2005 beta and one thing that I was thrilled
about in advance was the CollectionBase class. No more selfmade Collection
classes I thought.
But now I'm puzzled, I can't have a Collection class based on the
CollectionBase that accepts strings as key? It only accepts integers!
Why would I use a CollectionBase class as the base class of my collection
if
it can't have a string as it's key?
Why not stick to the old way and have an internal
Collection/Hashtable/ListDictionary/WhatEver as holder for your objects ?

Should I make a suggestion to MS?

Regards
/Kejpa

Nov 21 '05 #4
On Fri, 5 Nov 2004 09:34:32 +0200, Kejpa wrote:
I've begun trying out the .NET2005 beta and one thing that I was thrilled
about in advance was the CollectionBase class. No more selfmade Collection
CollectionBase also exists in .Net 1.1. I haven't looked at it closely,
but is the one in .Net 2.0 any different?
Why would I use a CollectionBase class as the base class of my collection if
it can't have a string as it's key?


With the addition of generics to VB.Net, you may not need to create your
own collection classes anymore. For example, suppose you have a custom
class called MyCustomClass and you need a collection of them with a string
as a key. You can use a dictionary like this using generics:

Dim oDict As New Dictionary(Of String, MyCustomClass)

Then you can add items

Dim oCustom As New MyCustomClass
oDict.Add("Key",oCustom)

And you can access the dictionary without casting:

Dim oNewCustom As MyCustomClass = oDict("Key")

The generic collection classes available include Collection, Dictionary,
KeyedCollection, KeyValuePair, LinkedList, Queue, Stack, SortedDictionary,
and others.

I would say for the vast majority of collection needs, the built in generic
classes should fit the bill. But, you can also create you own, too! I
just hope they release it in early 2005 rather than later.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve M | last post by:
I have subclassed CollectionBase. I have also implemented GetEnumerator(). I have tried to set the DataSource of a DataGrid to an instance of my subclass. However, the items in the grid are not...
7
by: m. pollack | last post by:
Hi all, I've been using the CollectionBase class to implement a strongly-typed collection, but I have noticed that the RemoveAt method does not seem to call the "On" hook methods (OnRemove,...
2
by: m.pollack | last post by:
Hi all, I have an application which uses a class object that contains a collection. In order to use the PropertyGrid control to expose properties to the user at runtime, I created a...
1
by: alanrn | last post by:
I've implemented a number of strongly-typed collections that inherit from CollectionBase and recently noticed something that I don't fully understand. CollectionBase defines method RemoveAt(). ...
0
by: Mike Pollett | last post by:
Hi, I have used the ISerializable interface before and the code below worked fine. Until I derived it from CollectionBase. The code will still serialize and deserialize the properties in this class...
1
by: Mike Pollett | last post by:
Hi, I have used the ISerializable interface before and the code below worked fine. Until I derived it from CollectionBase. The code will still serialize and deserialize the properties in this class...
5
by: Eric Johannsen | last post by:
I have a simple object that inherits from CollectionBase and overrides the Count property: namespace MyTest { public class CollTest : System.Collections.CollectionBase { public override int...
2
by: Samuel R. Neff | last post by:
What's the advantage of inheriting from CollectionBase as opposed to just implementing IList? It seems that it saves you from having to implement a few properties (Clear, CopyTo, Count,...
0
by: LIJO CHEERAN | last post by:
Hello friends I am trying to study about CollectionBase. I have inherited CollectionBase in the class TheCollection.cs. I am using the “TheCollection. in an aspx page to store objects...
3
by: Tony Johansson | last post by:
Hello! Sorry for opening up this task again. I want to fully understand this List that is return from CollectionBase. According to you is List in CollectionBase implemented something like...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.