ref out
2016-05-18 10:33
316 查看
They're pretty much the same - the only difference is that a variable you pass as an
outparameter doesn't need to be initialized but passing it as a
refparameter it has to be set to something.
int x; Foo(out x); // OK int y; Foo(ref y); // Error: y should be initialized before calling the method
Refparameters are for data that might be modified,
outparameters are for data that's an additional output for the function (eg
int.TryParse) that are already using the return value for something.
相关文章推荐
- 2007版的office软件下载及简介
- Fourth-更丰富的用户界面
- HashMap和Hashtable的区别
- android连接Mysql数据库之JDBC方式
- 漫谈代理模式
- Linux 之 shell 比较运算符
- Third-实现基本交互
- linux中开启和关闭防火墙
- Spark RpcEnv
- Spark中的事件处理分析
- Fragment学习关注网址
- Rxjava中toList操作符
- ios清除缓存3
- 尖峰日96万订单,59校园狂欢节技术架构剖析
- Second-创建第一个项目
- Reactor模式和Proactor模式
- 使用通知选择城市
- [XPath/Python] XPath 与 lxml (二)XPath 语法 - iFantasticMe
- 国与史
- Property和attribute的区别[转]