C# Syntax & Basic Data Types

লেসন ১ / ৫০

C# কী?

C# (C-Sharp) Microsoft তৈরি একটি modern, statically-typed, OOP language যা .NET platform-এ চলে। Web API, Desktop, Mobile (MAUI), Game (Unity) — সবকিছু C# দিয়ে।

সরল প্রোগ্রাম

using System;

namespace HelloApp {
    class Program {
        static void Main(string[] args) {
            Console.WriteLine("স্বাগতম C#!");
            string name = "করিম";
            int age = 25;
            Console.WriteLine($"নাম: {name}, বয়স: {age}");
        }
    }
}

// .NET 6+ Top-level statement
Console.WriteLine("Hello!");

Primitive Data Types

TypeSizeউদাহরণ
int32-bit42
long64-bit10000000000L
double64-bit float3.14
decimal128-bit (money)99.99m
booltrue/falsetrue
charএকটি UTF-16 char'A'
stringUnicode text"করিম"

String Interpolation ও Verbatim

string name = "Rahim";
int age = 30;

string s1 = $"নাম: {name}, বয়স: {age}";   // interpolation
string s2 = @"C:\Users\Rahim\file.txt";    // verbatim (no escape)
string s3 = $@"Path: C:\{name}";            // both

Comment

// Single line
/* Multi
   line */
/// <summary>XML doc comment</summary>