473,511 Members | 16,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Collection object: Use CollectionBase, Generics, or DataSet

_DS
I need to create arrays of a custom data type (which is composed of
various strings, ints, the usual). The original was built using
CollectionBase. I was thinking about redesigning to use generics, but
I realized that DataSets may also work here.

I do need to display and edit lists of the items at various places.
In the previous version I used a custom ListView for most display
purposes.

Given that DataSets in VS2005 have so many extended features,
including integration with DataViews, etc., is there any reason not to
go this route? What are the disadvantages? Storage overhead? Access
speed?
Jan 27 '06 #1
4 3445
Hi,

"_DS" <_D*@Nospamforme.com> wrote in message
news:7t********************************@4ax.com...
I need to create arrays of a custom data type (which is composed of
various strings, ints, the usual). The original was built using
CollectionBase. I was thinking about redesigning to use generics, but
I realized that DataSets may also work here.
If it's working fine, I usually prefer do not change it
I do need to display and edit lists of the items at various places.
In the previous version I used a custom ListView for most display
purposes.
You can do this whatever route you go
Given that DataSets in VS2005 have so many extended features,
including integration with DataViews, etc., is there any reason not to
go this route? What are the disadvantages? Storage overhead? Access
speed?


The dataset would be the last option for me, you won't be using the most
useful features of it, like relationships, etc, it would also dilute the
concept of a type that (hopefuly) you have rignt now.

A generic collection works like a strong typed collection in most of the
cases, one of the motives to introduce genercs was to not have to implement
almost the same code each time you want a strong typed collection.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 27 '06 #2
For what its worth, I agree with Ignacio. I wouldn't use DataSets either. I
refer to the DataSet as the Anti-OOP. Or perhaps I should call it the ~OOP.

Custom collections with indexers, and all the other cool features you get
from CollectionBase are definitely the way to go for framework version 1.1
and for the same reasons plus, as Ignacio said, better code re-use, generics
in framework version 2.0.

--
Dale Preston
MCAD C#
MCSE, MCDBA
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

"_DS" <_D*@Nospamforme.com> wrote in message
news:7t********************************@4ax.com...
I need to create arrays of a custom data type (which is composed of
various strings, ints, the usual). The original was built using
CollectionBase. I was thinking about redesigning to use generics, but
I realized that DataSets may also work here.


If it's working fine, I usually prefer do not change it
I do need to display and edit lists of the items at various places.
In the previous version I used a custom ListView for most display
purposes.


You can do this whatever route you go
Given that DataSets in VS2005 have so many extended features,
including integration with DataViews, etc., is there any reason not to
go this route? What are the disadvantages? Storage overhead? Access
speed?


The dataset would be the last option for me, you won't be using the most
useful features of it, like relationships, etc, it would also dilute the
concept of a type that (hopefuly) you have rignt now.

A generic collection works like a strong typed collection in most of the
cases, one of the motives to introduce genercs was to not have to implement
almost the same code each time you want a strong typed collection.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 28 '06 #3
_DS
On Fri, 27 Jan 2006 09:02:37 -0500, "Ignacio Machin \( .NET/ C# MVP
\)" <ignacio.machin AT dot.state.fl.us> wrote:
"_DS" <_D*@Nospamforme.com> wrote in message
news:7t********************************@4ax.com.. .
I need to create arrays of a custom data type (which is composed of
various strings, ints, the usual). The original was built using
CollectionBase. I was thinking about redesigning to use generics, but
I realized that DataSets may also work here.


If it's working fine, I usually prefer do not change it


Thanks for your reply, Ignacio. In this case it's not a matter of "If
it's not broke." The design is still in formative stages. I need to
settle on something that will endure.
I do need to display and edit lists of the items at various places.
In the previous version I used a custom ListView for most display
purposes.


You can do this whatever route you go


Yeah, I guess so. I was wondering if any subtleties in the DataSet
(vs Collection) would lend to advantages in binding or editing. If
there is no difference, then I guess the advantage goes to the
Collection approach. It should be faster and easier on ram.

Jan 29 '06 #4
_DS
On Sat, 28 Jan 2006 12:50:27 -0800, "Dale" <da******@nospam.nospam>
wrote:
For what its worth, I agree with Ignacio. I wouldn't use DataSets either. I
refer to the DataSet as the Anti-OOP. Or perhaps I should call it the ~OOP.
<g> Interesting comment, Dale. Are you excluding strongly typed
DataSets? (I'm guessing that you're referring to weak typing).
Custom collections with indexers, and all the other cool features you get
from CollectionBase are definitely the way to go for framework version 1.1
and for the same reasons plus, as Ignacio said, better code re-use, generics
in framework version 2.0.


I was initially thinking that there would be better binding features
with DataSets, but since I don't need relational capabilities I'll go
with CollectionBase for now. Generics later when I'm more comfortable
with them.

Jan 31 '06 #5

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

Similar topics

2
2498
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
3
2872
by: Andrew J. Marshall | last post by:
It was SO easy in VB6. Add a few methods, set a few funky properties and *BAM*, type-safe collection class that supports the For Each...Next syntax. I've been trying to do this in VB.NET with...
27
413
by: Craig Buchanan | last post by:
Which vb.net object is the best match for the vb6 collection class? Specifically, I would like to be able to access the Item property with an index or a key string. I wrote my own class that...
2
3706
by: Ian Gore | last post by:
Hi, I'm relatively new to VB.NET so I'd be grateful if someone could point out what I don't understand here... 1) Creating a strongly typed collection by inheriting CollectionBase. This is...
3
1336
by: Michael Fällgreen | last post by:
Hi, I need to make a strongly typed collection of x, and the simplets way is to inherits list(of x). With that I can bind to a list-control. However - i don't need all the methods from list(of...
3
3525
by: GBR | last post by:
I have a collection object inherited from collection base that is used to carry my object entities from server to client through a web service. I want to add a dataset to this collection object and...
6
5630
by: SharpCoderMP | last post by:
hi, until .net 2.0 i've been writing my own collections derived from CollectionBase. Now with the generics it is much easier to do that... but! i have some questions about generic lists of...
14
1684
by: cwineman | last post by:
Hello, I'm hoping to do something using Generics, but I'm not sure it's possible. Let's say I want to have a bunch of business objects and a data access class cooresponding to each business...
11
1848
by: Bit Byte | last post by:
I am writing a generic container class which I want to support the 'foreach' statement. My class looks something like this: class MyClass<T: CollectionBase { //Implementation for...
0
7242
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
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
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...
0
7510
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
5668
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,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
447
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.