Setup Developement Environment for C#:

C# is used for server side execution for different kind of application like web, window forms or console etc. In order to use C# with your .Net application, you need two things, .NET Framework and IDE (Integrated Development Environment).

The .NET Framework:

The .NET Framework is a platform where you can write different types of web and desktop based applications. You can use C#, Visual Basic, F# and Jscript to write these applications. If you have the Windows operating system, the .NET framework might already be installed in your PC. Check MSDN to learn about .NET Framework dependencies.

Integrated Development Environment (IDE):

An IDE is a tool that helps you write your programs. Visual Studio is an IDE provided by Microsoft to write the code in languages such as C#, F#, VisualBasic, etc. Use Visual Studio 2010/2012/2013 based on the C# version you want to work with.

You can write C# code with notepad also. Build your C# program using command line tool csc.exe. Visit MSDN for more information.

Visual Studio is a licensed product, so you must buy a license for commercial use. However, Visual Studio Express is free for learning purpose. Download and install Visual Studio Express from We will use Visual Studio Express 2012 for all the C# tutorials.

C# can be used in a window-based, web-based, or console application. To start with, we will create a console application to work with C#.

Create a C# console project by clicking VS2012 -> File -> New Project...

Create console project in VS2012

From the popup, select Visual C# under Templates (in the right column) and select Console Application from the middle column.

Select Project Template

In the name section, give any appropriate project name, location where you want to create all the project files and solution name.

Click OK to create the console project. Program.cs will be created as default .cs file in Visual Studio where you can write your C# code in Program class as shown below.

C# Console Program

Thus, you can create a console application with C# using Visual Studio.

Advantages of Visual Studio:

  • Easy to create, edit, search different types of files required for the development.
  • Easily to use Microsoft or third party Source control.
  • Visual studio includes an excellent debugger that allows you to debug code easily. Step through the application code to understand it line by line, or identify problems in your code.
  • Intellisense support for MS .Net API classes.
  • Easy to incorporate web services, or third-party controls or libraries.
  • Nuget support for installing thrid party API/controls in the application.

Let's write first C# console program in the next section.