What's the difference between an argument and a parameter?

后端 未结 30 2449
北恋
北恋 2020-11-22 01:08

When verbally talking about methods, I\'m never sure whether to use the word argument or parameter or something else. Either way the other people know what

30条回答
  •  我寻月下人不归
    2020-11-22 01:50

    A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters.

    public void MyMethod(string myParam) { }
    
    ...
    
    string myArg1 = "this is my argument";
    myClass.MyMethod(myArg1);
    

提交回复
热议问题