Setup Developement Environment for C#
C# is used for server-side execution for a different kind of application like web, window forms or console, etc. 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 on 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 the latest version of Visual Studio (2017) to learn C#.
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.
From the New Project popup as shown below, select Visual C# in the left side panel and select the Console App in the right-side panel.
In the name section, give any appropriate project name, location where you want to create all the project files, and the name of the project solution.
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.)
Thus, you can create a C# console application in Visual Studio. Now, you can write C# code in the 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 enhances 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.