473,320 Members | 1,699 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

wg
I am attempting to create a collection where store and modify multiple
entries (i.e. Key, FirstName, LastName, Address, City, Phone, etc). I have
attempted to use the CollectionBase but have not been able to add more that
2 objects. Can anyone tell me how to do this or the best way.

Thanks
Feb 9 '06 #1
3 2580
Are all those part of one record? Can you explain a little more about what
you want. Collections are usually (but not always) meant to store data of
the same (or similar) data.

Can you provide some simple code showing what you are doing?

"wg" <wg@hotmail.com> wrote in message
news:cf*****************@bignews3.bellsouth.net...
I am attempting to create a collection where store and modify multiple
entries (i.e. Key, FirstName, LastName, Address, City, Phone, etc). I have
attempted to use the CollectionBase but have not been able to add more that
2 objects. Can anyone tell me how to do this or the best way.

Thanks

Feb 9 '06 #2
Hi,

I see that you want to create a custom collection class. Can you please
tell me what all you have done so far?

CollectionBase is an abstract class and can be used for creating
strongly-typed collections. Normally, you inherit from CollectionBase
and implement what all methods are exposed by your class. How did you
add items to your custom collection class? You must have used the
IList.Add method, right?

And, can you please tell me your exact requirement/usage scenario? A
very basic sample scenario would be "Class" and "Student" (each class
has a collection of students), where you create a class named
StudentCollection(or any other name of your choice) which inherits
CollectionBase. This is done mostly only you want a strongly-typed
collection for holding Student objects only.

Regards,
Jim
<<Work smart, not hard!>>

Feb 9 '06 #3
wg
Thanks to both for the insight. I will start working on a Class to inherit
the collectionbase. But in the meantime here is what I am trying to do in
the end.

I want to create a class that will load a *.csv (comma delimeted file) and
parse out each column. I will never know the length of the file so I know I
have to use an arraylist. Each column will have a variable in the array per
say. Then in my program I want access to each of these parameters. I also
want the ability to change the value of a few of the variables that were
loaded. This information will be used throughout the program so I will make
the class a Singleton.

So far I have been able to open and load the csv file, make the class a
singleton. But as of yet I have not been able to load each column variable
into its own variable for access outside.

Thanks again for the direction.
wg
"wg" <wg@hotmail.com> wrote in message
news:cf*****************@bignews3.bellsouth.net...
I am attempting to create a collection where store and modify multiple
entries (i.e. Key, FirstName, LastName, Address, City, Phone, etc). I have
attempted to use the CollectionBase but have not been able to add more that
2 objects. Can anyone tell me how to do this or the best way.

Thanks

Feb 9 '06 #4

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
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.