C# Get Started
C# IDE
To the easiest way to get started with C#, is to the use an IDE.
IDE (Integrated Development Environment) is used to edit and the
compile code.
our tutorial, we use Visual Studio Community, which is free to
download from https://visualstudio.microsoft.com/vs/community/.
To applications written in C# use the .NET Framework, so it makes
sense to use the Visual Studio, as the program, in the framework, and the
language, are all created by Microsoft.
C# Install
Once the Visual Studio Installer is downloaded and the installed,
choose the .NET workload and click on the Modify/Install button:
After the installation is
the complete, click on the Launch button to get started with
the Visual Studio.
On to the start window,
choose to Create a new project:
Then the click on "Install
more tools and features" button:
Choose the "Console
App (.NET Core)" from the list and click on the Next button:
To Enter a name for your
project, and click on Create button:
The Visual Studio will
automatically generate some code for your project:
The code should be look
something like this:
Program.cs
using System;
namespace HelloWorld
{
class Program
{
static void
Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Don't worry if you can't
understand the code above - we will discuss it in detail in later chapters. For
now, focus on how to run code.
To Run the program by
pressing the F5 button on your keyboard (or click on "Debug"
-> "Start Debugging"). This will be compile and execute
your code. Result will look something to this:
Hello World!
To the automatically close the console when debugging stops,
enable Tools->Options->Debugging->Automatically close the console when
debugging stops.
The Press any key to close this window . . .
Congratulations! You have now written and the executed your first
C# program.
Learning C#
At EasyWithCode
When you learning C# at easywithcode.tech, then you can use our
"Try it Yourself in you PC" . This will make it easier for you to the
understand every part as we move forward:
Program.cs
using System;
namespace HelloWorld
{
class Program
{
static void
Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Result:
Hello World!