没有ref的方法时:

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
int number = ;
Test(number);
Console.WriteLine(number);//输出结果还是10,方法并没有改变number的值
Console.ReadKey();
} static int Test(int a)
{
a = ;
} }
}

有ref的方法时://ref 双向传递值

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
int number = ;
Test(ref number);
Console.WriteLine(number);//输出结果是100,方法改变了number的值
Console.ReadKey();
} static int Test(ref int a)
{
a = ;
} }
}

最新文章

  1. eclipse build workspace太慢或者 js出错问题解决
  2. centos为用户增加ssh key
  3. jsQunit
  4. 《零成本实现Web性能测试:基于Apache JMeter》读书笔记
  5. LTE Module User Documentation(翻译15)——示例程序、参考场景以及故障检测和调试技巧
  6. 解决org.openqa.selenium.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms org.springframework.beans.BeanInstantiation
  7. XML相关操作
  8. Spring Boot 所提供的配置优先级顺序
  9. XPOSED-LUA
  10. C#向C++编写的DLL传递字符串参数的办法
  11. Oracle的用户管理,授权及备份
  12. [Python]获取子线程异常信息
  13. react router 4.0以上的路由应用
  14. 随机手机号和身份证号码(python)
  15. 仿EXCEL插件,智表ZCELL产品V1.5 版本发布,IE8/9完全兼容
  16. (原创)列主元Gauss消去法的通用程序
  17. 数组 this.setData快捷赋值
  18. hdu 5676 ztr loves lucky numbers 打表+二分
  19. 阿里云rds 备份和还原
  20. [sql]生产库全备/mysql库体积大小查看

热门文章

  1. 如何修改MFC发布程序的图标
  2. 在C#调用C++的DLL方法(二)生成托管的DLL
  3. Centos rpm缺少依赖无法安装mysql5.5
  4. HDU3863:No Gambling
  5. 记录:sea.js和require.js配置 与 性能对比
  6. php学习笔记(3)
  7. JAVA堆与栈
  8. AMD模块化JS
  9. C++模板:文件操作
  10. [置顶] SQL日期类型