Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
raghulvarma
Starting Member
21 Posts |
Posted - 2008-10-14 : 04:26:47
|
In my console application I have a class and a main function to it asnamespace Console1{ Public class Program1 { static void Main (string[] args) { Console.WriteLine("Hai"); } }} I have created another new application and the namespace is Console2 and the class name is Program2, I have reffered this to my Console 2 by the following waynamespace Console2{ using Console2; Public class Program2 { static void Main (string[] args) { } }} Now if I need to get the Main function of Program1 in Program2 how should I do that?ThanksRaghul |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-10-14 : 04:44:45
|
Tryprogram1 Raghul = new program1() But bear in mind, both classes return nothing |
|
|
raghulvarma
Starting Member
21 Posts |
Posted - 2008-10-14 : 12:51:57
|
I tried using the reflection conceptI added the reference of console1 with that of Console2 and I implemented the concept of reflection.namespace Console2 { using Console1; Public class Program2 { static void Main (string[] args) { Assembly sampleassembly; sampleassembly = Assembly.LoadFrom("ConsoleApplication2"); MethodInfo mi = sampleassembly.GetTypes()[0].GetMethod("Main"); } } } here it shows an error as file not found what has to be done?is there any way ?thanks in advanceRaghul |
|
|
|
|
|