Click here to Skip to main content
15,913,486 members
Home / Discussions / C#
   

C#

 
QuestionUsing a C DLL in a C# Application... Pin
signbit23-Mar-06 6:04
signbit23-Mar-06 6:04 
AnswerRe: Using a C DLL in a C# Application... Pin
Judah Gabriel Himango23-Mar-06 6:13
sponsorJudah Gabriel Himango23-Mar-06 6:13 
GeneralRe: Using a C DLL in a C# Application... Pin
Mridang Agarwalla23-Mar-06 6:42
Mridang Agarwalla23-Mar-06 6:42 
GeneralRe: Using a C DLL in a C# Application... Pin
Judah Gabriel Himango23-Mar-06 7:08
sponsorJudah Gabriel Himango23-Mar-06 7:08 
Questionupload file to the server c# win form Pin
fady_sayegh23-Mar-06 5:57
fady_sayegh23-Mar-06 5:57 
QuestionUserSettings in VS 2005, how they serialize? Pin
TigerNinja_23-Mar-06 4:49
TigerNinja_23-Mar-06 4:49 
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 

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.