在C#中的参数/参数之间的差异 [英] Difference between arguments/parameters in C#

查看:137
本文介绍了在C#中的参数/参数之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter\">What's参数和参数?

是什么参数与放大器之间的差异;在C#中的参数?

What is the difference between an argument & a parameter in C#?

他们是同样的事情?

推荐答案

好了,既不关键字是在语言present,所以问题是有些模糊。可以做的最好的是看每个术语是如何在C#语言规范使用(1.6.6.1参数):

Well, neither keyword is present in the language, so the question is somewhat vague. The best that can be done is to look how each term is used in C# language specification (1.6.6.1 "Parameters"):

参数的用于值或变量引用传递给方法。方法的参数从参数获取它们的实际值的被调用方法时指定的。

Parameters are used to pass values or variable references to methods. The parameters of a method get their actual values from the arguments that are specified when the method is invoked.

所以,参数指的名称的,和论据指的的绑定到这些名称。例如:

So, "parameters" refer to names, and "arguments" refer to values bound to those names. E.g.:

void Foo(int x, int y); // x and y are parameters
Foo(1, 2);  // 1 and 2 are arguments

这篇关于在C#中的参数/参数之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆