Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have 2 console application and have declared a method and now I wan to call that method in other console application .What should I do for That.
Posted

Hi Mohd,

you can add a reference to a dll or to an exe. So if the method (should be public) is part of an .NET executable, add that executable as a reference to your project. You can now add a suitable "using" declaration to your code and call it.

Modification

Code below assumes that in name space "my.name.sapce" there's class called Program that has two methods one of which is static and the other an instance method.
End Modification

using my.name.space;
...
public void Test()
{
    Program.AStaticMethod();
    Program p = new Program();
    p.ANonStaticMethod();
}
...



Cheers


Manfred
 
Share this answer
 
v3
Comments
UndCOVer 19-May-22 15:25pm    
12 years later, thank you man ... your answer helped me so much
How about Remoting??[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900