C# (Sharp) Programming Language Question:

Download Job Interview Questions and Answers PDF

How can I create a process that is running a supplied native executable (e.g., cmd.exe)?

C# (Sharp) Programming Language Interview Question
C# (Sharp) Programming Language Interview Question

Answer:

The following code should run the executable and wait for it to exit before
continuing: using System;
using System.Diagnostics;
public class ProcessTest {
public static void Main(string[] args) {
Process p = Process.Start(args[0]);
p.WaitForExit();
Console.WriteLine(args[0] + " exited.");
}
}
Remember to add a reference to System.Diagnostics.dll when you compile.

Download C# (Sharp) Programming Language Interview Questions And Answers PDF

Previous QuestionNext Question
What optimizations does the C# compiler perform when you use the /optimize+ compiler option?What is the difference between the System.Array.CopyTo() and System.Array.Clone()?