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
| Type | Size | উদাহরণ |
|---|---|---|
| int | 32-bit | 42 |
| long | 64-bit | 10000000000L |
| double | 64-bit float | 3.14 |
| decimal | 128-bit (money) | 99.99m |
| bool | true/false | true |
| char | একটি UTF-16 char | 'A' |
| string | Unicode 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>