ရိုးရိုးလေး ရှင်းပြမယ်
What is C#? ကို ရိုးရိုးလေးနားလည်မယ်
C# သည် Microsoft မှ ဖန်တီးထားသော modern, object-oriented, type-safe programming language တစ်ခုဖြစ်ပါတယ်။ Type-safe ဆိုတာ variable တစ်ခုမှာ ဘယ်လို data ထည့်မယ်ဆိုတာကို compiler က သေချာစစ်ပေးတာပါ။ ဥပမာ int ထဲကို စာသားထည့်မယ်ဆိုရင် run မလုပ်ခင်တည်းက သတိပေးပေးပါတယ်။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
C# language version, .NET SDK နဲ့target framework ကိုတစ်ခုတည်းလို့ယူဆခြင်းက compatibility ပြဿနာဖြစ်စေနိုင်ပါတယ်။
ဖြစ်လေ့ရှိတဲ့အမှား
Happy path တစ်ခု run အောင်ရုံဖြင့် code မှန်ကန်၊ maintainable နဲ့production-ready ဖြစ်ပြီဟုယူဆခြင်း။
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
C# သည် .NET platform အတွက် strongly typed, garbage-collected, object-oriented language ဖြစ်ပြီး console, web, cloud, desktop, mobile နဲ့game workloads များရေးနိုင်ပါတယ်။ Modern .NET နဲ့ legacy .NET Framework ကိုခွဲသိပြီး supported runtime/SDK ကိုရွေးရပါတယ်။
- Typed input
- C# expression + method
- CLR value / object state
What is C#? ရဲ့core concept နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
// C# program တစ်ခုက class ထဲက Main method မှစတင်အလုပ်လုပ်ပါတယ်။
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello from C#!");
}
}
}C# သည် .NET platform အတွက် strongly typed, garbage-collected, object-oriented language ဖြစ်ပြီး console, web, cloud, desktop, mobile နဲ့game workloads များရေးနိုင်ပါတယ်။ Modern .NET နဲ့ legacy .NET Framework ကိုခွဲသိပြီး supported runtime/SDK ကိုရွေးရပါတယ်။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Typed input
// C# program တစ်ခုက class ထဲက Main method မှစတင်အလုပ...C# သည် Microsoft မှ ဖန်တီးထားသော modern, object-oriented, type-safe programming language တစ်ခုဖြစ်ပါတယ်။ Type-safe ဆိုတာ variable တစ်ခုမှာ ဘယ်လို data ထည့်မယ်ဆိုတာကို compiler က သေချာစစ်ပေးတာပါ။ ဥပမာ int ထဲကို စာသားထည့်မယ်ဆိုရင် run မလုပ်ခင်တည်းက သတိပေးပေးပါတယ်။
- C# expression + method
static void Main(string[] args)C# သည် .NET platform အတွက် strongly typed, garbage-collected, object-oriented language ဖြစ်ပြီး console, web, cloud, desktop, mobile နဲ့game workloads များရေးနိုင်ပါတယ်။ Modern .NET နဲ့ legacy .NET Framework ကိုခွဲသိပြီး supported runtime/SDK ကိုရွေးရပါတယ်။
- CLR value / object state
}Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။
- Typed input
- C# expression + method
- CLR value / object state
Success
What is C#? ရဲ့core concept နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
Failure
C# language version, .NET SDK နဲ့target framework ကိုတစ်ခုတည်းလို့ယူဆခြင်းက compatibility ပြဿနာဖြစ်စေနိုင်ပါတယ်။
C# သည် Microsoft မှ ဖန်တီးထားသော modern, object-oriented, type-safe programming language တစ်ခုဖြစ်ပါတယ်။ Type-safe ဆိုတာ variable တစ်ခုမှာ ဘယ်လို data ထည့်မယ်ဆိုတာကို compiler က သေချာစစ်ပေးတာပါ။ ဥပမာ int ထဲကို စာသားထည့်မယ်ဆိုရင် run မလုပ်ခင်တည်းက သတိပေးပေးပါတယ်။
// C# program တစ်ခုက class ထဲက Main method မှစတင်အလုပ်လုပ်ပါတယ်။
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello from C#!");
}
}
}ဒီ code က ဘာလုပ်တာလဲ
using System;က Console လို built-in tools တွေသုံးနိုင်အောင် ခေါ်ထားတာပါ။namespaceက code တွေကို folder စနစ်လို အုပ်စုခွဲပြီး စနစ်တကျထားပေးပါတယ်။class Programထဲမှာ program ရဲ့ logic တွေကိုရေးပါတယ်။Mainmethod က app စတင်အလုပ်လုပ်တဲ့နေရာပါ။Console.WriteLine()က terminal ထဲကိုစာကြောင်းတစ်ကြောင်းထုတ်ပြပါတယ်။
Hello from C#!Info
🔎 သတိထားရန်
C# မှာ statement အများစုကို semicolon ; နဲ့အဆုံးသတ်ရပါတယ်။ မေ့သွားရင် compiler က ချက်ချင်းငြင်းပါလိမ့်မယ်။
Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။
Mini challenge
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။
- Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
- Normal input နဲ့ edge case စမ်းပါ
- Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
// C# program တစ်ခုက class ထဲက Main method မှစတင်အလုပ်လုပ်ပါတယ်။
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello from C#!");
}
}
}ရလဒ်: What is C#? ရဲ့core concept နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။
Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Typed input → C# expression + method → CLR value / object state
- C# သည် .NET platform အတွက် strongly typed, garbage-collected, object-oriented language ဖြစ်ပြီး console, web, cloud, desktop, mobile နဲ့game workloads များရေးနိုင်ပါတယ်။ Modern .NET နဲ့ legacy .NET Framework ကိုခွဲသိပြီး supported runtime/SDK ကိုရွေးရပါတယ်။
- C# language version, .NET SDK နဲ့target framework ကိုတစ်ခုတည်းလို့ယူဆခြင်းက compatibility ပြဿနာဖြစ်စေနိုင်ပါတယ်။
- Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။
C# documentation — Microsoft Learn