본문 바로가기

c# ☃️

[C#] 메소드 생성 방법

namespace MetEx;
class Program
{
    static void Main(string[] args)
    {
        WriteSomething();
        WriteSomethingSpecific("i'm an argument and am called from a method");
    }

    public static void WriteSomething()
    {
        Console.WriteLine("i'm called from a method!");
    }

    public static void WriteSomethingSpecific(string myText)
    {
        Console.WriteLine(myText);
    }
}



실행결과

'c# ☃️' 카테고리의 다른 글

[C#] 예외처리 - try/catch/finally  (0) 2024.03.25
[C#] 출력 - ReadLine()  (0) 2024.03.25
[c#] 전역변수 불변의 법칙  (0) 2024.03.16
[c#] var 사용방법  (0) 2024.03.04
[c#] string 안에 따음표 ” 슬래쉬 / 사용  (1) 2024.03.04