C# ka Introduction
C# ek compiled, statically typed, garbage-collected language hai jo CLR (Common Language Runtime) ke liye bani hai — Microsoft ka JVM jaisa equivalent. Java ki tarah, C# bhi C++ ki manual memory management ko chhod kar automatic garbage collection use karta hai, lekin apne khud ke distinct features bhi add karta hai: first-class properties, collections query karne ke liye LINQ, callback mechanism ke liye dedicated delegates aur events, aur classes ke saath-saath genuine value types ke roop mein structs.
Is course ka compiler Mono ka C# compiler hai, koi modern .NET SDK nahi — ye roughly C# version 7 tak support karta hai (string interpolation, properties, LINQ, generics, tuples) lekin baad ke features jaise switch expressions, records, ya top-level statements support nahi karta. Yahan har lesson sirf wahi cover karta hai jo actually compile hona confirm ho chuka hai.
Ek jaldi preview
Ye hai ek real C# program, jo actually is page ke apne compiler par execute kiya gaya hai — koi mockup nahi:
using System;
class Program {
static void Main() {
Console.WriteLine("C#: strongly typed, garbage collected, and built for the CLR.");
}
}C#: strongly typed, garbage collected, and built for the CLR.
Ye hai Console.WriteLine, C# ka standard tareeka output dikhane ka. Agla lesson aapka pehla full program run karta hai aur exactly explain karta hai ki kya ho raha hai.
Practice exercise
Ek variable version naam ka banao, jiska type int ho aur value 12 ho, phir "C# version: " ke baad version print karo Console.WriteLine ka use karke.