So, as far as I know, there is no way to achieve this without pushing data through your application.
The code for this is as follows:
using System; using System.Diagnostics; using System.IO; using System.Threading; namespace TestApp { internal static class Program { [MTAThread] public static void Main(string[] args) { const string fileName = @"..\..\..\ChildConsoleApp\bin\Debug\ChildConsoleApp.exe";
My child app code looks like this:
using System; namespace ChildConsoleApp { internal static class Program { public static void Main() { Console.WriteLine("Hi"); string text;
As always, this has some overhead, although this is probably negligible in any non-trivial application that you wrap.
If you send a large amount of data and want to avoid flushing more than necessary, you can increase the buffer size from 4 KB to what suits you.
source share