Andy's blog

If you always do what you've always done, you'll always get what you've always got.

0%

2020-11-16-Methods介紹

認識 Method 方法


參考資料:
T003_Methods_Static_namespace


Method 寫法

1
2
3
4
AccessLevel ReturnType methodName(Parameters)
{
MethodBody
}

Method 參數共三種

  1. pass by value
  2. pass by reference
    1
    2
    3
    4
    public static void RefKeyword(ref int paramter)
    {
    paramter = 100;
    }

3.Out keyword

允許return 超過一個value