C# Programming for Beginners
C# (C-Sharp) is a modern, object-oriented language developed by Microsoft as part of the .NET initiative. It is the core language for Unity games and Windows enterprise software.
2. Basic Program Structure
A C# program uses namespaces and a Static Main method as the entry point.
using System;
namespace HelloWorld {
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello C#!");
}
}
}
10. Classes & Objects
In C#, everything revolves around objects. A class is a blueprint, and an object is an instance of that blueprint.
class Player {
public string name;
public void Greet() { Console.WriteLine("Hi " + name); }
}
Player p = new Player();
p.name = "Dhanush";
p.Greet();