c#里边如果在main函数下定义一个简单类型int a;
那么我如何通过一个函数传入这个变量的引用?(传地址)
那么我如何通过一个函数传入这个变量的引用?(传地址)
解决方案 »
- Xml序列化问题
- 关于xml中存取图片的问题
- 求一个正则表达式
- c#软件注册如何做呢?
- 如何做出掷骰子的效果,就像QQ飞行棋里那种掷骰子的效果。(可以另外给分)
- 窗口传值问题。。
- 怎么样根据文件的扩展名来决定文件的图标?
- 关于 DataGrid 的模版列放入 RadioButtonList的问题!!给分100
- 这个事件有什么限制吗,,
- 老外的打印例子是否有错,为什么打印不出DATAGRID的数据?http://www.c-sharpcorner.com/Graphics/DataGridPrinterMG.asp
- 非常奇怪的问题, 大哥们帮帮我吧, 着急啊!!
- 在VS.NET2005的C#中把EXCEL2003的数据导入SQL-SERVER2000的问题? (急!!!!!!)
public class MyClass
{
public static void TestRef(ref char i)
{
// The value of i will be changed in the calling method
i = 'b';
} public static void TestNoRef(char i)
{
// The value of i will be unchanged in the calling method
i = 'c';
} // This method passes a variable as a ref parameter; the value of the
// variable is changed after control passes back to this method.
// The same variable is passed as a value parameter; the value of the
// variable is unchanged after control is passed back to this method.
public static void Main()
{
char i = 'a'; // variable must be initialized
TestRef(ref i); // the arg must be passed as ref
Console.WriteLine(i);
TestNoRef(i);
Console.WriteLine(i);
}
}
输出
b
b