我把 parameter 和 argument 弄混了,没有真正注意什么时候使用一个,什么时候使用另一个.
I got parameter and argument kind of mixed up and did not really pay attention to when to use one and when to use the other.
你能告诉我吗?
参数是变量,它是方法签名(方法声明)的一部分.参数是调用方法时使用的表达式.
A parameter is the variable which is part of the method’s signature (method declaration). An argument is an expression used when calling the method.
考虑以下代码:
void Foo(int i, float f)
{
// Do things
}
void Bar()
{
int anInt = 1;
Foo(anInt, 2.0);
}
这里i
和f
是参数,anInt
和2.0
是参数.
Here i
and f
are the parameters, and anInt
and 2.0
are the arguments.
上一篇:jQuery将更多参数传递给回调回调、参数、更多、jQuery
下一篇:难道DateTime.toFileTimeUtc实际工作?我不能出示UTC FILETIME实际、工作、toFileTimeUtc、DateTime