S
Steven Wolf
Hi folks,
i developing right now a big project for my company and i have follow
issue:
I have a base class for all my domain objects (abstract DomainObject)
and many objects derived from that class, like Facility
omainObject.
I have also a collection class (DomainObjectCollection:CollectionBase)
which can add [public void Add (DomainObject domainObject)] and return
[public DomainObject this [int index]] only DomainObject's.
When i try to get a domain object from the collection, all the time i
have to play with casting, like:
....
Facility facility;
facility = (Facility)domainObjectCollection[3]; // Return domain
object
....
but i can do..
domainObjectCollection.Add(facility)
...without any conversion/casting problems, but i MUST cast when
retrieve, why?
isnt there any cool solution? it looks pretty ugly all the time when i
have to cast.. :-(
thanks!
Steven.
i developing right now a big project for my company and i have follow
issue:
I have a base class for all my domain objects (abstract DomainObject)
and many objects derived from that class, like Facility

I have also a collection class (DomainObjectCollection:CollectionBase)
which can add [public void Add (DomainObject domainObject)] and return
[public DomainObject this [int index]] only DomainObject's.
When i try to get a domain object from the collection, all the time i
have to play with casting, like:
....
Facility facility;
facility = (Facility)domainObjectCollection[3]; // Return domain
object
....
but i can do..
domainObjectCollection.Add(facility)
...without any conversion/casting problems, but i MUST cast when
retrieve, why?
isnt there any cool solution? it looks pretty ugly all the time when i
have to cast.. :-(
thanks!
Steven.