C#中的OUT关键字
2017-01-10 19:35
162 查看
用于输出结果,可以不用赋初始值就可以当实参传递,但是在方法中必须进行赋值,比如年龄的计算,上年,今年,明年的年龄
public void getAge(int _age ,out int _lastAge,out _nextAge){
_lastAge=_age-1;
_nextAge=_age+1;
}
调用:
int lastAge,nextAge;
int age=5;
getAge(age,lastAge,nextAge)
public void getAge(int _age ,out int _lastAge,out _nextAge){
_lastAge=_age-1;
_nextAge=_age+1;
}
调用:
int lastAge,nextAge;
int age=5;
getAge(age,lastAge,nextAge)
相关文章推荐
- C# ref和out关键字
- 用MSIL剥开C#的外衣(一):方法参数ref、out、params和lock、for和foreach关键字
- 注意C#中的ref及out关键字
- C#中关键字ref与out的区别(原创)
- C# 参考之方法参数关键字:params、ref及out
- DEMO[C#]refKeyword and outKeyword 关于ref与out关键字区别的DEMO
- C# 参考之方法参数关键字:params、ref及out
- C#中关键字ref与out的区别(原创)
- C# 参考之方法参数关键字:params、ref及out 引用-http://www.cnblogs.com/hunts/archive/2007/01/13/619620.html
- 从堆栈浅析c#的ref、out关键字
- 用MSIL剥开C#的外衣(一):方法参数ref、out、params和lock、for和foreach关键字
- C# 参考之方法参数关键字:params、ref及out
- [转]浅谈C#当中的out关键字
- C# 参考之方法参数关键字:params、ref及out
- C# 参考之方法参数关键字:params、ref及out
- C# ref和out关键字
- C# 中的ref & out关键字 的区别
- C# 参考之方法参数关键字:params、ref及out
- C# 参考之方法参数关键字:params、ref及out
- C# Out/Ref关键字的理解和区别