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
'C# > ์ด๊ฒ์ด C#์ด๋ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
31. ๊ตฌ์กฐ์ฒด, ๋ณ๊ฒฝ ๋ถ๊ฐ๋ฅ ๊ตฌ์กฐ์ฒด(readonly struct) (0) | 2022.02.14 |
---|---|
30. ํ์ฅ ๋ฉ์๋ (0) | 2022.02.14 |
28. ์ค์ฒฉ ํด๋์ค (0) | 2022.02.11 |
27. ์ฝ๊ธฐ ์ ์ฉ ํ๋, readonly (0) | 2022.02.11 |
26. ์ค๋ฒ๋ผ์ด๋ฉ ๋ด์ธํ๊ธฐ (0) | 2022.02.11 |