Click here to Skip to main content
15,898,868 members
Home / Discussions / C#
   

C#

 
QuestionC# Question with Generics [modified] Pin
malharone21-Feb-07 15:04
malharone21-Feb-07 15:04 
AnswerRe: C# Question with Generics Pin
Christian Graus21-Feb-07 15:12
protectorChristian Graus21-Feb-07 15:12 
GeneralRe: C# Question with Generics [modified] Pin
malharone21-Feb-07 15:16
malharone21-Feb-07 15:16 
GeneralRe: C# Question with Generics Pin
Christian Graus21-Feb-07 16:02
protectorChristian Graus21-Feb-07 16:02 
GeneralRe: C# Question with Generics Pin
mike montagne26-Feb-07 14:53
mike montagne26-Feb-07 14:53 
GeneralRe: C# Question with Generics Pin
malharone27-Feb-07 11:13
malharone27-Feb-07 11:13 
GeneralRe: C# Question with Generics Pin
mike montagne27-Feb-07 13:36
mike montagne27-Feb-07 13:36 
GeneralRe: C# Question with Generics Pin
malharone27-Feb-07 13:48
malharone27-Feb-07 13:48 
What I meant was currently line
#4 is: DomainObject _selectedObject
#6 is: public void AddItem (DomainObject obj)
#9 is: public DomainObject SelectedObject

If DomainObject is converted to a generic class, then I can't really compile the ListViewEx class with the above code lines. I must change the declarations as well to .. :
#4 is: DomainObject<??> _selectedObject
#6 is: public void AddItem (DomainObject<??> obj)
#9 is: public DomainObject<??> SelectedObject

So the correct question is, what would I substitue "??" with? if you're implying the following, then there may be a possiblity but that'd just create unnecessary classes and cause confusion:
abstract class BaseObj
{
}
abstract class DomainObject <T> : BaseObj
{
}
class Car : DomainObject <Car>
{
}
class Boat : DomainObject <Boat>
{
}
class ListViewEx
{
   void AddItem (BaseObj obj)
   {
   }
}


The "BaseObj" is simply an empty class and it just changes the object model where consumers can begin using 'baseobj' instead of DomainObject -- since classes such as "ListViewEx" have been changed to accept BaseObj.

- Malhar
GeneralRe: C# Question with Generics Pin
mike montagne27-Feb-07 13:47
mike montagne27-Feb-07 13:47 
GeneralRe: C# Question with Generics Pin
malharone27-Feb-07 14:01
malharone27-Feb-07 14:01 
GeneralRe: C# Question with Generics Pin
mike montagne27-Feb-07 19:24
mike montagne27-Feb-07 19:24 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 6:25
mike montagne28-Feb-07 6:25 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 7:06
mike montagne28-Feb-07 7:06 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 7:09
mike montagne28-Feb-07 7:09 
GeneralRe: C# Question with Generics Pin
mike montagne28-Feb-07 8:14
mike montagne28-Feb-07 8:14 
AnswerRe: C# Question with Generics Pin
Colin Angus Mackay21-Feb-07 22:09
Colin Angus Mackay21-Feb-07 22:09 
GeneralRe: C# Question with Generics Pin
malharone22-Feb-07 7:03
malharone22-Feb-07 7:03 
AnswerRe: C# Question with Generics Pin
darkelv22-Feb-07 0:42
darkelv22-Feb-07 0:42 
GeneralRe: C# Question with Generics Pin
malharone22-Feb-07 7:49
malharone22-Feb-07 7:49 
GeneralRe: C# Question with Generics Pin
malharone27-Feb-07 11:13
malharone27-Feb-07 11:13 
QuestionStart reading at the end of a file? Pin
TheJudeDude21-Feb-07 14:05
TheJudeDude21-Feb-07 14:05 
AnswerRe: Start reading at the end of a file? Pin
Shajeel21-Feb-07 18:54
Shajeel21-Feb-07 18:54 
GeneralRe: Start reading at the end of a file? Pin
TheJudeDude22-Feb-07 3:31
TheJudeDude22-Feb-07 3:31 
GeneralRe: Start reading at the end of a file? Pin
Luc Pattyn22-Feb-07 8:08
sitebuilderLuc Pattyn22-Feb-07 8:08 
QuestionISerializable.GetObjectData Method Example Pin
Gywox21-Feb-07 11:53
Gywox21-Feb-07 11:53 

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.