Click here to Skip to main content
15,906,292 members
Home / Discussions / C#
   

C#

 
AnswerRe: Remoting and Symantec firewall Pin
Paul Conrad13-Jul-07 12:01
professionalPaul Conrad13-Jul-07 12:01 
GeneralRe: Remoting and Symantec firewall Pin
Wjousts13-Jul-07 14:04
Wjousts13-Jul-07 14:04 
GeneralRe: Remoting and Symantec firewall Pin
Paul Conrad13-Jul-07 14:09
professionalPaul Conrad13-Jul-07 14:09 
QuestionDynamically Declaring and object of a class Pin
Sallu174913-Jul-07 4:01
Sallu174913-Jul-07 4:01 
AnswerRe: Dynamically Declaring and object of a class Pin
Christian Graus13-Jul-07 4:04
protectorChristian Graus13-Jul-07 4:04 
GeneralRe: Dynamically Declaring and object of a class Pin
Sallu174913-Jul-07 4:10
Sallu174913-Jul-07 4:10 
GeneralRe: Dynamically Declaring and object of a class Pin
Giorgi Dalakishvili13-Jul-07 4:16
mentorGiorgi Dalakishvili13-Jul-07 4:16 
AnswerRe: Dynamically Declaring and object of a class Pin
Kevin McFarlane13-Jul-07 4:21
Kevin McFarlane13-Jul-07 4:21 
You can do this using reflection.

Here's an example using .NET 1.1.

Assembly assembly = Assembly.GetExecutingAssembly();

// Find out from config file which ContinentFactory to create
string continentFactory = ConfigurationSettings.AppSettings["ContinentFactory"];

Binder binder = null; 

// Create ContinentFactory instance
Type continentType = assembly.GetType(continentFactory);
object[] args = null;
ContinentFactory continentInstance = (ContinentFactory) continentType.InvokeMember(
	null,
	BindingFlags.DeclaredOnly | 
	BindingFlags.Public | BindingFlags.NonPublic | 
	BindingFlags.Instance | BindingFlags.CreateInstance, binder, null, args
);

// Create AnimalWorld instance
string animalWorld = "PatternsTest.AnimalWorld";
Type worldType = assembly.GetType(animalWorld);
args = new object[] { continentInstance };
AnimalWorld worldInstance = (AnimalWorld) worldType.InvokeMember(
	null,
	BindingFlags.DeclaredOnly | 
	BindingFlags.Public | BindingFlags.NonPublic | 
	BindingFlags.Instance | BindingFlags.CreateInstance, binder, null, args
);


// Call AnimalWorld.RunFoodChain
worldInstance.RunFoodChain();


);



Kevin

QuestionCreateControl in another thread Pin
Peterson Luiz13-Jul-07 2:54
Peterson Luiz13-Jul-07 2:54 
AnswerRe: CreateControl in another thread Pin
Patrick Etc.13-Jul-07 7:45
Patrick Etc.13-Jul-07 7:45 
AnswerRe: CreateControl in another thread Pin
S. Senthil Kumar13-Jul-07 17:27
S. Senthil Kumar13-Jul-07 17:27 
QuestionPing Leaking Pin
Malcolm Smart13-Jul-07 2:53
Malcolm Smart13-Jul-07 2:53 
AnswerRe: Ping Leaking Pin
kubben13-Jul-07 3:28
kubben13-Jul-07 3:28 
GeneralRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 3:49
Malcolm Smart13-Jul-07 3:49 
GeneralRe: Ping Leaking Pin
Dan Neely13-Jul-07 3:55
Dan Neely13-Jul-07 3:55 
GeneralRe: Ping Leaking Pin
kubben13-Jul-07 3:58
kubben13-Jul-07 3:58 
GeneralRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 4:15
Malcolm Smart13-Jul-07 4:15 
GeneralRe: Ping Leaking Pin
kubben13-Jul-07 4:19
kubben13-Jul-07 4:19 
AnswerRe: Ping Leaking Pin
leppie13-Jul-07 3:43
leppie13-Jul-07 3:43 
GeneralRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 3:51
Malcolm Smart13-Jul-07 3:51 
GeneralRe: Ping Leaking Pin
leppie13-Jul-07 4:07
leppie13-Jul-07 4:07 
AnswerRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 5:03
Malcolm Smart13-Jul-07 5:03 
GeneralRe: Ping Leaking Pin
Dave Kreskowiak13-Jul-07 6:30
mveDave Kreskowiak13-Jul-07 6:30 
QuestionJava to C# eBook Pin
Sukhjinder_K13-Jul-07 2:45
Sukhjinder_K13-Jul-07 2:45 
AnswerRe: Java to C# eBook Pin
Christian Graus13-Jul-07 3:24
protectorChristian Graus13-Jul-07 3:24 

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.