simple IPC mechanism for C#/WPF application to imp

2020-07-27 02:17发布

问题:

So I've been reading lots about interprocess communication on .Net. Named pipes, remoting. It all seems great but possibly overkill for what I need to do.

I want to add a command line interface to my WPF application, so I need a simple IPC mechanism to send the string from one process to the already running app.

What does SO recommend for doing so?

回答1:

NamedPipeClientStream and NamedPipeServerStream are pretty simple. Here's a pretty simple example where IPC is used to pass command line arguments from one instance of an application to another. It's not exactly what you want to do, but pretty close.