Click here to Skip to main content
15,893,487 members
Home / Discussions / C#
   

C#

 
AnswerRe: UserSettings in VS 2005, how they serialize? Pin
TigerNinja_23-Mar-06 5:28
TigerNinja_23-Mar-06 5:28 
QuestionRelay information back to parent window. Pin
zaboboa23-Mar-06 4:01
zaboboa23-Mar-06 4:01 
AnswerRe: Relay information back to parent window. Pin
LongRange.Shooter23-Mar-06 4:22
LongRange.Shooter23-Mar-06 4:22 
GeneralRe: Relay information back to parent window. Pin
zaboboa23-Mar-06 4:32
zaboboa23-Mar-06 4:32 
Questioncasting an abstract class to a subclass Pin
gregbowe23-Mar-06 3:53
gregbowe23-Mar-06 3:53 
AnswerRe: casting an abstract class to a subclass Pin
Stefan Troschuetz23-Mar-06 4:04
Stefan Troschuetz23-Mar-06 4:04 
GeneralRe: casting an abstract class to a subclass Pin
gregbowe23-Mar-06 4:29
gregbowe23-Mar-06 4:29 
GeneralRe: casting an abstract class to a subclass Pin
J4amieC23-Mar-06 4:47
J4amieC23-Mar-06 4:47 
Presumably there is some shared functionality which is then implemented by the Concrete class (the ones defined in the config) so the abstract class (or interface) should be sufficient:

class MyBaseClass
{
   abstract void DoSomething();
}

class MyConcreeteClass1 : MyBaseClass
{
  override coid DoSomething()
  {
    Console.WriteLine("From 1");
  }
}

class MyConcreeteClass2 : MyBaseClass
{
  override coid DoSomething()
  {
    Console.WriteLine("From 2");
  }
}


now, notice the only time I specify the class name is in a string - same as your config:

Type t1 = Type.GetType("MyConcreteClass1");<br />
Type t2 = Type.GetType("MyConcreteClass2");<br />
MyBaseClass o1 = (MyBaseClass)Activator.CreateInstance(t1);<br />
MyBaseClass o2 = (MyBaseClass)Activator.CreateInstance(t2);<br />
o1.DoSomething();<br />
o2.DoSomething();


-- modified at 10:48 Thursday 23rd March, 2006
GeneralRe: casting an abstract class to a subclass Pin
gregbowe23-Mar-06 5:17
gregbowe23-Mar-06 5:17 
GeneralRe: casting an abstract class to a subclass Pin
Stefan Troschuetz23-Mar-06 4:59
Stefan Troschuetz23-Mar-06 4:59 
QuestionPLEASE HELP ME IN THIS PROBLEM Pin
snouto23-Mar-06 3:00
snouto23-Mar-06 3:00 
AnswerRe: PLEASE HELP ME IN THIS PROBLEM Pin
leppie23-Mar-06 9:41
leppie23-Mar-06 9:41 
QuestionOutlook Pin
Talktorajeev23-Mar-06 2:46
Talktorajeev23-Mar-06 2:46 
AnswerRe: Outlook Pin
Judah Gabriel Himango23-Mar-06 6:11
sponsorJudah Gabriel Himango23-Mar-06 6:11 
GeneralRe: Outlook Pin
Talktorajeev23-Mar-06 16:13
Talktorajeev23-Mar-06 16:13 
GeneralRe: Outlook Pin
Judah Gabriel Himango23-Mar-06 16:30
sponsorJudah Gabriel Himango23-Mar-06 16:30 
QuestionPlease see this problem..... Pin
sam_g123-Mar-06 1:08
sam_g123-Mar-06 1:08 
AnswerRe: Please see this problem..... Pin
Adiphe23-Mar-06 1:20
Adiphe23-Mar-06 1:20 
GeneralRe: thanks Adiphe Pin
sam_g123-Mar-06 1:38
sam_g123-Mar-06 1:38 
QuestionHelp needed !!!! Pin
Ahmad Mahmoud [candseeme]23-Mar-06 0:53
Ahmad Mahmoud [candseeme]23-Mar-06 0:53 
AnswerRe: Help needed !!!! Pin
mav.northwind23-Mar-06 3:53
mav.northwind23-Mar-06 3:53 
QuestionHow to access unmanaged function in c# Pin
Killer323-Mar-06 0:29
Killer323-Mar-06 0:29 
AnswerRe: How to access unmanaged function in c# Pin
NassosReyzidis23-Mar-06 0:36
NassosReyzidis23-Mar-06 0:36 
AnswerRe: How to access unmanaged function in c# Pin
AB777123-Mar-06 0:53
AB777123-Mar-06 0:53 
NewsRe: How to access unmanaged function in c# Pin
leppie23-Mar-06 2:17
leppie23-Mar-06 2:17 

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.