Getting Started
What’s CSharp?
C# is a high-level, general-purpose programming language developed by Microsoft as part of the .NET framework. It’s an object-oriented language, meaning it uses objects to structure code and data, and is used to build a variety of applications. C# is known for its ease of learning, strong community support, and ability to produce highly performant code.
.NET SDK Instalation
The easiest way to have the .NET SDK installed in your personal computer is to download Visual Studio. You can also use other IDE, but you will need to install the SDK manually.
Hello World
A sample C# program is show here.
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Run the program as below:
$ dotnet run Program.cs
Variables
Normal Declaration:
string firstName = "Someone";
char userOption = 'A';
int gameScore = 123;
float percentage = 12.10;
double portion = 4.556
decimal particlesPerMillion = 123.4567;
bool processedCustomer = true;
Implicitly Typed:
var message = "Hello world!";
Constant
const int ConstNum = 5;