title: Get return value from process
body: <p>Hi I am trying to do the following:
  I have a process which can take parameters (digits)
  and return the sum of these numbers</p>
  
  <pre><code>Process P = Process.Start(sPhysicalFilePath, Param);
                  int result = P.ExitCode;
  </code></pre>
  
  <p>I get the return value from "ExitCode"
  the problem is:
  the program sometimes finishes his work before the process 
  so when the program reaches this line </p>
  
  <pre><code>int result = P.ExitCode;
  </code></pre>
  
  <p>I got an exception ..
  my question is how to wait this process until it finishes its work
  sorry I forget to say that's I am working with C# language</p>