ExecProcess ClassCleanCode C# Libraries v1.2.03 API
Invokes an arbitrary program and returns the results.
Inheritance Hierarchy

OnlineSystem Object
  CleanCode.IO ExecProcess

Namespace: CleanCode.IO
Assembly: CleanCode (in CleanCode.dll) Version: (1.2.03)

public class ExecProcess

The results of an external process are collected in one or more Lists. You may collect output from STDOUT and STDERR separately (if for example) you want to display STDOUT results but you want to parse STDERR results and take some other action. Alternately, you may collect the STDOUT and STDERR outputs jointly, interleaved so they show up in temporal order.

Each of the three collections (stdout, stderr, joint list) may be turned on or off via a property (CollectStdOut, CollectStdErr, or CollectJointOutput, respectively). When dealing with small amounts of data, it would not be burdensome to have them all enabled, but if you expect large amounts of data you should enable only those that you will specifically need.

Adapted from notes and community content on http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(VS.80).aspx

Since CleanCode 0.9.15.


private List<string> RunCode()
    ExecProcess runner = new ExecProcess("xyz.exe", tempfile);
    runner.CollectJointOutput = true;
    return runner.JointOutput;
See Also