Introduction
Welcome to this C# tutorial. With the introduction of the .NET framework, Microsoft included a new language called C# (pronounced C Sharp). C# is designed to be a simple, modern, general-purpose, object-oriented programming language, borrowing key concepts from several other languages, most notably Java.
C# could theoretically be compiled to machine code, but in real life, it's always used in combination with the .NET framework. Therefore, applications written in C#, requires the .NET framework to be installed on the computer running the application. While the .NET framework makes it possible to use a wide range of languages, C# is sometimes referred to as THE .NET language, perhaps because it was designed together with the framework.
C# is an Object Oriented language and does not offer global variables or functions. Everything is wrapped in classes, even simple types like int and string, which inherit from the System.Object class.
Setup Development 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
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#.
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 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 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.)
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 third party API/plug-ins in an application.
- Supports
integration with many other third-party productive utilities which enhance 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.
0 Comments