在口头谈论方法时,我永远不会确定是使用单词参数还是其他参数 。 无论哪种方式,其他人都知道我的意思,但是什么是正确的,这些术语的历史是什么?
我是C#程序员,但我也想知道人们是否使用不同语言的不同术语。
为了纪录我自学,没有计算机科学的背景。 (请不要告诉我阅读代码完成,因为我问这个是为了没有Steve McConnell的奇妙书的其他人的利益。)
概要
普遍的共识似乎是可以在团队环境中互换使用这些术语。 除了定义准确的术语之外, 那么你也可以使用“ 正式参数/参数”和“ 实际参数/参数”来消除歧义。
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 I mean, but what's correct, and what's the history of the terms?
I'm a C# programmer, but I also wonder whether people use different terms in different languages.
For the record I'm self-taught without a background in Computer Science. (Please don't tell me to read Code Complete because I'm asking this for the benefit of other people who don't already have a copy of Steve McConnell's marvellous book.)
Summary
The general consensus seems to be that it's OK to use these terms interchangeably in a team environment. Except perhaps when you're defining the precise terminology; then you can also use "formal argument/parameter" and "actual argument/parameter" to disambiguate.
最满意答案
参数是方法定义中的变量。 当调用一个方法时,参数是传递给方法参数的数据。
public void MyMethod(string myParam) { } ... string myArg1 = "this is my argument"; myClass.MyMethod(myArg1);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);更多推荐
发布评论