I have two C# applications that I have coded. I would like for the application B to get the values from texboxes of application A. Both applications would be running at the same time. What is the best way to go about it? I already have a solution that writes a file with necessary strings from app A and then I seperatly load that file in app B - is there a more direct solution that's not too complex?
Asked
Active
Viewed 145 times
0
-
What version of C# are you using? if you are not using .Net Core, you can use WCF COM to communicate between two applications -- which is built into C# – Ilan Keshet Jul 11 '22 at 07:08
-
1WCF was deprecated in .Net Core -- and you can use grpc for communication in that. – Ilan Keshet Jul 11 '22 at 07:09
-
https://stackoverflow.com/questions/14476332/communication-between-two-winform-application-using-wcf – Ilan Keshet Jul 11 '22 at 07:09
-
If I'm being honest file is the simplest way to do that. You can use Inter Process Communication(IPC) but it usually will need lot of code or use of 3rd party library – Lokanath Jul 11 '22 at 07:09
-
_"What is the best way"_ - what is your definition of "best"? – Fildor Jul 11 '22 at 07:10
-
https://stackoverflow.com/questions/7353670/wcf-named-pipe-minimal-example – Ilan Keshet Jul 11 '22 at 07:10
-
2You have many things to your disposal: gRPC, REST, Pipes, MessageQueues (maybe look into the .Net spin of ZeroMQ -> [NetMQ](https://netmq.readthedocs.io/en/latest/)) ... I would avoid really slow solutions like FileSystem I/O or legacy technologies like WCF. The advantage of using a network-based communication is that you can later decide to have them running on different machines without the need to change anyting in the code. – Fildor Jul 11 '22 at 07:12
-
^^ What is "best" depends on your requirements and your choice of criteria that define "good" for you. Without having any deeper knowledge about your project, all we can do is tell you _possible_ technologies. Which one fits best is up to you. – Fildor Jul 11 '22 at 07:18
-
1@IlanKeshet those links would only be useful if OP was using a specific framework (non .net Core) but OP put the wrong tags in the question, we lack information – Cleptus Jul 11 '22 at 07:18
-
^^ You could also utilize a database, even. It really depends on what problem you are actually trying to solve and what the applications need. For example: What if B tries to read before A has been started? – Fildor Jul 11 '22 at 07:22
-
[NamedPipeClientStream](https://learn.microsoft.com/en-us/dotnet/api/system.io.pipes.namedpipeclientstream) / [NamedPipeServerStream](https://learn.microsoft.com/en-us/dotnet/api/system.io.pipes.namedpipeserverstream) -- Very simple to use and .Net-agnostic. – Jimi Jul 11 '22 at 07:26
-
Does this answer your question? [What is the easiest way to do inter process communication in C#?](https://stackoverflow.com/questions/1802475/what-is-the-easiest-way-to-do-inter-process-communication-in-c) – Rezaeimh7 Jul 11 '22 at 07:31
-
If you just need to send some strings (that may be wrapped in a class object to serialize), you could just send a [WM_COPYDATA](https://learn.microsoft.com/en-us/windows/win32/dataxchg/wm-copydata) message. -- A [MemoryMappedfFile](https://learn.microsoft.com/en-us/dotnet/api/system.io.memorymappedfiles.memorymappedfile) can be used inter-process – Jimi Jul 11 '22 at 07:33