Parameter and Argument


Bart De Smet 在《C# 4.0 Unleashed》一書的 Methods 一章提到:

... The distinction is quite simple, though. Parameters live on a declaration site, whereas arguments are specified in a call site.

... Depending on the angle you approach them, they’re very similar: One makes up the receiving end; the other makes up the sending end.

何時該用 Parameter,何時該用 Argument?就用你當時的「視角」(或者說情境)來分辨:

  • 如果是在「寫」 Function/Method,那麼你可能會宣告(或定義)該 Function/Method 的 parameter。例:function SayHello accept two parameters
  • 如果是「呼叫」 Function/Method,這時就應該說 argument。例:pass two arguments to function SayHello。