Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To reuse a Process StandardInput in C#, you can do the following:

  1. Create a new instance of the Process class.
  2. Set the RedirectStandardInput property to true.
  3. Start the process using the Start() method.
  4. Write data to the StandardInput stream using the Write() method.
  5. Call the WaitForExit() method to wait for the process to complete.
  6. Close the StandardInput stream using the Close() method.
  7. Repeat the above steps with the same process instance as many times as needed.

Note: It is important to close the StandardInput stream after each use, as leaving it open can cause unexpected behavior.