Thuta Learning
ရှာဖွေရန်
BasicProgrammingbeginner

Data Types

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

C# data types တွေကို နားလည်ထားရင် program ထဲမှာ data ကို မှန်မှန်ကန်ကန်သိမ်းနိုင်ပါတယ်။ Data type မှန်မှ code မှန်မယ်၊ code မှန်မှ bug နည်းမယ်။ “Box ထဲကို ဘာထည့်မလဲ” ကို အစကတည်းက သတ်မှတ်ထားတာလို့ တွေးပါ။

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}");

အဓိက သိထားရန်

  • Value typesint, double, char, bool စတဲ့ data ကို တိုက်ရိုက်သိမ်းတဲ့ type များပါ။
  • Reference typesstring, arrays, classes စတာတွေပါ။ Object တည်နေရာကို reference အနေနဲ့ကိုင်ထားပါတယ်။
  • char မှာ single quote 'A' သုံးပြီး string မှာ double quote "Hello" သုံးပါတယ်။
You should see
Laptop x 3 Price: 19.99 Available: True
Data Types | Thuta Learning