473,503 Members | 8,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2589
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
3510
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
1850
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
1746
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
2078
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
2160
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
7070
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
5900
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
6951
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
1147
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
2109
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
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.