Knowing C#'s data types lets you store data correctly throughout your program. Right data type, right code; right code, fewer bugs. Think of it as deciding "what goes in the box" right from the start.
csharp
int quantity = 3; // ကိန်းပြည့်
long population = 54000000L; // ကြီးတဲ့ကိန်းပြည့်
double price = 19.99; // ဒသမကိန်း
char grade = 'A'; // စာလုံးတစ်လုံး
bool isAvailable = true; // true / false
string product = "Laptop"; // စာသား
Console.WriteLine($"{product} x {quantity}");
Console.WriteLine($"Price: {price}");
Console.WriteLine($"Available: {isAvailable}");Key things to know
- Value types —
int,double,char,booland similar types that store data directly. - Reference types —
string, arrays, classes, and the like. These hold a reference to where the object actually lives. charuses single quotes'A', whilestringuses double quotes"Hello".
You should see
Laptop x 3 Price: 19.99 Available: True