A call? Of course no. The whole notion of a call is only applicable to a method. Well, to a property, too, if a property is considered as its
getter or
setter.
However, the functionality you want is quite possible.
First, you should seriously think if you really want to communicate with a separate process. This approach has a lot of problems. As another application is in C#, think about using is as a class library instead and run the methods of this library in the host process. If you need working of this method in parallel you can run some library code in a different thread, but still in the same process. This is million times better. Separate processes are well isolated, they are not primarily designed to be integrated together. So running the code in a single process is absolutely the best you can do.
No assume that you cannot do it. Maybe you don't have the source code of this application, and available code is not suitable to serve as a library (yes, you can use any assembly compiled as .EXE application as a library in .NET). Taking into account that the different processes are well isolated, but you still need communication between them, you need what? Right, only one thing: IPC (Inter-Process Communication).
There are different ways to do IPC. Probably your best bet is using WCF, self-hosted by the "another application", classical remoting can also do the job. In this case, from the standpoint of your host process the communication may look exactly like a method call, but in fact it will be a call to a method of WCF or remoting object proxy. If your processes are on the same machine, the transport channel can be based on
named pipes, and such channel is also called IPC. Other suitable methods include TCP sockets (better using
TcpListener/TcpClient
), named pipes used directly, and more. I still think WCF is better.
Start from here:
http://msdn.microsoft.com/en-us/library/ms731758.aspx[
^],
http://msdn.microsoft.com/en-us/library/bb332338.aspx#msdnwcfhc_topic3[
^],
http://www.youtube.com/watch?v=FPrQPA9QmUw[
^];
on CodeProject:
WCF Comparison with Web Services and .NET Remoting[
^],
A Quick and Dirty WCF Service and Client (Using WCF and Winforms)[
^],
Writing your first WCF Service[
^],
WCF (Windows Communication Foundation) Introduction and Implementation[
^].
[EDIT]
To see the status of a process, use the class
System.Diagnostics.Process
,
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[
^].
—SA