Thuta Learning
C#
BasicProgrammingအခြေခံ

What is C#?

C#သင်ခန်းစာ 220 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • What is C#? ရဲ့core concept နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်
  • Normal, boundary နဲ့invalid cases ကိုကိုယ်တိုင်စမ်းနိုင်ရန်
  • Readable, type-safe နဲ့testable C# code ရေးနိုင်ရန်

ရိုးရိုးလေး ရှင်းပြမယ်

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 ကိုရွေးရပါတယ်။

Mental Model
  1. Typed input
  2. C# expression + method
  3. CLR value / object state

What is C#? ရဲ့core concept နဲ့runtime behavior ကိုရှင်းပြနိုင်ရန်

အဓိက Syntax / Pattern

csharp
// 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 ကို အဆင့်လိုက်ဖတ်မယ်

  1. Typed input// C# program တစ်ခုက class ထဲက Main method မှစတင်အလုပ...

    C# သည် Microsoft မှ ဖန်တီးထားသော modern, object-oriented, type-safe programming language တစ်ခုဖြစ်ပါတယ်။ Type-safe ဆိုတာ variable တစ်ခုမှာ ဘယ်လို data ထည့်မယ်ဆိုတာကို compiler က သေချာစစ်ပေးတာပါ။ ဥပမာ int ထဲကို စာသားထည့်မယ်ဆိုရင် run မလုပ်ခင်တည်းက သတိပေးပေးပါတယ်။

  2. C# expression + methodstatic 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 ကိုရွေးရပါတယ်။

  3. CLR value / object state}

    Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။

Execution Flow
  1. Typed input
  2. C# expression + method
  3. 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 မလုပ်ခင်တည်းက သတိပေးပေးပါတယ်။

csharp
// 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 တွေကိုရေးပါတယ်။
  • Main method က app စတင်အလုပ်လုပ်တဲ့နေရာပါ။
  • Console.WriteLine() က terminal ထဲကိုစာကြောင်းတစ်ကြောင်းထုတ်ပြပါတယ်။
You should see
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 ကိုခန့်မှန်းပါ
csharp
// 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

What is C#? ရဲ့ အဓိကသဘောတရားက ဘာလဲ။

Quick Quiz 2 / 3

ဘယ်အမှားကို အရင်ဆုံးရှောင်သင့်လဲ။

Quick Quiz 3 / 3

Real project မှာ ဘယ်လိုအသုံးချသင့်လဲ။

ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ

  • 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

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • C# language version, .NET SDK နဲ့target framework ကိုတစ်ခုတည်းလို့ယူဆခြင်းက compatibility ပြဿနာဖြစ်စေနိုင်ပါတယ်။
  • Happy path တစ်ခု run အောင်ရုံဖြင့် code မှန်ကန်၊ maintainable နဲ့production-ready ဖြစ်ပြီဟုယူဆခြင်း။

လက်တွေ့လေ့ကျင့်ခန်း

Console app တစ်ခုဖန်တီးပြီး project file, source file, build output နဲ့runtime target တို့၏တာဝန်ကိုရှင်းပြပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: Hello from C#!

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

What is C#? | Thuta Learning