C#/์ด๊ฒƒ์ด C#์ด๋‹ค

29. ๋ถ„ํ•  ํด๋ž˜์Šค

Rainbow๐ŸŒˆCoder 2022. 2. 11. 18:30
728x90

๋ถ„ํ•  ํด๋ž˜์Šค๋ž€ ์—ฌ๋Ÿฌ ๋ฒˆ์— ๋‚˜๋ˆ ์„œ ๊ตฌํ˜„ํ•˜๋Š” ํด๋ž˜์Šค๋ฅผ ๋งํ•œ๋‹ค.

๊ทธ ์ž์ฒด๋กœ ํŠน๋ณ„ํ•œ ๊ธฐ๋Šฅ์„ ํ•˜๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๋ฉฐ,

ํด๋ž˜์Šค์˜ ๊ตฌํ˜„์ด ๊ธธ์–ด์งˆ ๊ฒฝ์šฐ ์—ฌ๋Ÿฌ ํŒŒ์ผ์— ๋‚˜๋ˆ ์„œ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•จ์œผ๋กœ์จ ์†Œ์Šค ์ฝ”๋“œ ๊ด€๋ฆฌ์˜ ํŽธ์˜๋ฅผ ์ œ๊ณตํ•˜๋Š”๋ฐ ๊ทธ ์˜๋ฏธ๊ฐ€ ์žˆ๋‹ค.

 

๊ทธ๋ƒฅ ํ•˜๋‚˜์˜ ํด๋ž˜์Šค์ธ ๊ฒƒ ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. (ํด๋ž˜์Šค ์ด๋ฆ„์€ ๋™์ผํ•ด์•ผ ํ•œ๋‹ค.)

 

<์˜ˆ์ œ>

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace PartialClass
{
    partial class MyClass
    {
        public void Method1()
        {
            WriteLine("Method1");
        }
        public void Method2()
        {
            WriteLine("Method2");
        }
    }
    partial class MyClass
    {
        public void Method3()
        {
            WriteLine("Method3");
        }
        public void Method4()
        {
            WriteLine("Method4");
        }
    }

    class MainApp
    {
        static void Main(string[] args)
        {
            MyClass obj = new MyClass();
            obj.Method1();
            obj.Method2();
            obj.Method3();
            obj.Method4();
        }
    }
}

<์ถœ๋ ฅ ๊ฒฐ๊ณผ>

Method1
Method2
Method3
Method4
728x90