Tuesday, August 2, 2011

C# and .NET interview questions: - How do we create a Windows Process in .NET?

Process: - Process is a Component that provides access to the processes that are
running on a computer.

The Process component is a useful tool for starting, stopping, controlling, and
monitoring applications. Using the Process component, you can obtain a list of
the processes that are running, or you can start a new process.

Let’s demonstrate a simple example on Process to get a better idea.

Create a new project > Go to File > New > Project > and Select Console

Now, let’s demonstrate how exactly we can start new processes of the windows
using Process Component.

Go to “Program.cs” and import the following two namespace into it.

using System.Diagnostics;

using System.ComponentModel;

Below is the full code snippet for the same.

namespace MyProcessSample
class MyProcess
void OpenApplication(string myFavoritesPath)
// Display the contents of the favorites folder in the browser.

// Opens urls using Internet Explorer.
void OpenWithArguments()
Process.Start("IExplore.exe", "www.indonepal.com");

// Uses the ProcessStartInfo class to start new processes,
void OpenWithStartInfo()
ProcessStartInfo startInfo = new ProcessStartInfo("firefox.exe");
startInfo.Arguments = "www.questpond.com/demo.html";

static void Main()
// Get the path that stores favorite links.
string myFavoritesPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
MyProcess myProcess = new MyProcess();

Once you have done with above step just run your application and view the

Following you can view video on CAS, evidence, permission set & code groups: -

Get our more C# and Dotnet interview questions for preparation.


Also Visit for more author’s blog on Most asked c# interview questions

1 comment:

Toni said...

I think this interview question would be good for junior level members. I would also ask about how to capture output of a process. It is easy but not widely seen in examples.