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, the .NET Framework and an 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 latest version of Visual Studio (2017) to learn C#.

tip 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 Community edition is a free for individual developer for personal or commercial use. However, you can purchase a license for Visual Studio Professional or Enterprise edition. Download and install Visual Studio Community from visualstudio.com for free.

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#.

Open Visual Studio 2017 installed on your local machine. Click on File -> New Project... from the top menu as shown below.

Create a New Project in Visual Studio 2017

From the New Project popup as shown below, select Visual C# in the left side panel and select Console App in the right side panel.

Select Visual C# Console App 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 a C# file in Visual Studio where you can write your C# code in Program class as shown below. (The .cs is a file extension for C# file.)

C# Console Program

Thus, you can create a C# console application in Visual Studio. Now, you can write C# code in program.cs file to play with C#.

Advantages of Visual Studio

  • Easy to create, edit and navigate different files or applications.
  • 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 .Net Framework classes or custom classes.
  • Nuget support for installing thrid party API/plug-ins in an application.
  • Supports integration with many other third-party productive utilities which enhense the development quality and speed.
  • Easy to configure, build and publish .NET applications.
  • Provides ALM (Application Life-cycle Management) support for different phases of the development.

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