Click here to Skip to main content
15,922,166 members
Home / Discussions / C#
   

C#

 
GeneralCollection class with different class members Pin
pxp29-Jun-04 21:31
pxp29-Jun-04 21:31 
GeneralRe: Collection class with different class members Pin
Rakker7129-Jun-04 23:07
Rakker7129-Jun-04 23:07 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 5:05
pxp30-Jun-04 5:05 
GeneralRe: Collection class with different class members Pin
Heath Stewart30-Jun-04 5:56
protectorHeath Stewart30-Jun-04 5:56 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 7:32
pxp30-Jun-04 7:32 
GeneralRe: Collection class with different class members Pin
mav.northwind30-Jun-04 8:31
mav.northwind30-Jun-04 8:31 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 23:41
pxp30-Jun-04 23:41 
GeneralRe: Collection class with different class members Pin
mav.northwind1-Jul-04 0:29
mav.northwind1-Jul-04 0:29 
I think it's the easiest way to go.
In fact you wouldn't even have to derive from obj, because all classes in .NET implicitely inherit object, which is the item type of most base collections.

Using an obj interface might be the cleaner way if you want to ensure type safety at compile time. But then you have to make the collections typesafe (for example by deriving from CollectionBase and overriding the required methods). And find a meaningful interface.
I usually doubt if an empty marker-interface/base class (I think somebody suggested this) is a good idea from an object oriented view. By defining an interface you extract all common properties and behaviour into the interface, but if you can't find anything the different classes implementing your interface have in common then why should you create an interface?

One caveat remains, though. Using object derived items will allow you to add anything to your collection at compile time, even if this might not be desireable. You will not be able to check this until run time.

Regards,
Mav
GeneralRe: Collection class with different class members Pin
pxp1-Jul-04 3:28
pxp1-Jul-04 3:28 
GeneralRe: Collection class with different class members Pin
Heath Stewart30-Jun-04 8:35
protectorHeath Stewart30-Jun-04 8:35 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 22:47
pxp30-Jun-04 22:47 
GeneralRe: Collection class with different class members Pin
Heath Stewart1-Jul-04 3:54
protectorHeath Stewart1-Jul-04 3:54 
GeneralRe: Collection class with different class members Pin
pxp1-Jul-04 4:05
pxp1-Jul-04 4:05 
Generalvariable object names Pin
rturner00329-Jun-04 20:13
rturner00329-Jun-04 20:13 
GeneralRe: variable object names Pin
Colin Angus Mackay29-Jun-04 20:49
Colin Angus Mackay29-Jun-04 20:49 
GeneralRe: variable object names Pin
Nick Parker30-Jun-04 3:15
protectorNick Parker30-Jun-04 3:15 
GeneralCPU time consuming program Pin
Mikke_x29-Jun-04 19:45
Mikke_x29-Jun-04 19:45 
GeneralRe: CPU time consuming program Pin
Colin Angus Mackay29-Jun-04 20:42
Colin Angus Mackay29-Jun-04 20:42 
GeneralRe: CPU time consuming program Pin
Mikke_x30-Jun-04 6:16
Mikke_x30-Jun-04 6:16 
GeneralTreeview count parents Pin
saud_a_k29-Jun-04 19:40
saud_a_k29-Jun-04 19:40 
Generaloops.. I got it Pin
saud_a_k29-Jun-04 19:45
saud_a_k29-Jun-04 19:45 
GeneralOk One more question people Pin
saud_a_k29-Jun-04 19:57
saud_a_k29-Jun-04 19:57 
GeneralRe: Ok One more question people Pin
Heath Stewart30-Jun-04 6:02
protectorHeath Stewart30-Jun-04 6:02 
GeneralRe: Ok One more question people Pin
saud_a_k30-Jun-04 19:10
saud_a_k30-Jun-04 19:10 
GeneralGPS data via Bluetooth (com port communication) Pin
stanlyB2329-Jun-04 12:18
sussstanlyB2329-Jun-04 12:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.