Search code examples
c#-4.0inter-process-communicat

Inter process communication on same machine


using System;
using System.Diagnostics;
namespace csharp_station.howto
{
    /// <summary>
    /// Demonstrates how to start another program from C#
    /// </summary>
    class share
    {
        public int a;
        public int b;
    }

    class ProcessStart
    {
        static void Main(string[] args)
        {

            share share1 = new share();
            share1.a = 90;
            share1.b = 100;
            Process console36 = new Process();

            console36.StartInfo.FileName = @"e:\\ConsoleApplication36.exe";

            console36.Start();
        }
    }
}

Now i want to use object share1 in ConsoleApplication36.exe created in ConsoleApplication35.exe. How can i do this ??Please send me code for ConsoleApplication36.exe..


Solution

  • You can use Wcf named pipes for inter process communication. An other alternative is to pass arguments when starting the process if that is a sufficient solution.