AnyCompiler

C# Ka Taaruf

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 sath-sath genuine value types ki soorat 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 waqai compile hona confirm ho chuka hai.

Ek jaldi si jhalak

Ye hai ek real C# program, jo waqai is page ke apne compiler par execute hua hai — koi mockup nahi:

using System;

class Program {
    static void Main() {
        Console.WriteLine("C#: strongly typed, garbage collected, and built for the CLR.");
    }
}
Output
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 pura program chalata hai aur theek se batata hai ke kya ho raha hai.

Practice exercise

Ek variable version naam ka banayein, jiska type int ho aur value 12 ho, phir "C# version: " ke baad version print karein Console.WriteLine ka istemal kar ke.