C#下ref和out关键字使用
2012-03-23 15:55
155 查看
首先先看下边的程序
返回值
依次为
100
200
200
100
有问题的欢迎和我联系 我觉得这个例子就很具体了 pridescc@126.com
class Program { static void Main(string[] args) { int t1 = 100; Test1(ref t1); Console.WriteLine(t1); int t2; Test2(out t2); Console.WriteLine(t2); Console.ReadLine(); } public static void Test1(ref int t) { Console.Write(t); t = 200; Console.WriteLine(t); } public static void Test2(out int t) { t = 100; } }
返回值
依次为
100
200
200
100
有问题的欢迎和我联系 我觉得这个例子就很具体了 pridescc@126.com
相关文章推荐
- C# ref与out关键字的使用与区别
- C#里面ref和out关键字使用与区别
- C#方法参数传递-同时使用ref和out关键字
- C#方法参数传递-同时使用ref和out关键字
- C#中ref和out的使用小结
- c#学习体会:使用 ref 和 out 传递数组
- C# ref & out关键字
- c#中ref和out参数使用时需要注意的问题_百度文库
- C# 参考之方法参数关键字:params、ref及out
- C#中的ref out param关键字
- C#中使用ref 和 out 的一点认识
- C# 中out 和 ref 关键字的区别
- C# 关键字区别ref 和 out(文章来源:http://www.tzwhx.com/newOperate/html/1/12/123/19058.html)
- C#中 ref和out关键字的区别
- C#中关键字ref与out的区别
- C#中引用参数ref 、out的使用区别
- C# 关键字params、ref 和 out
- C# 方法参数关键字 params、ref及out
- C# 参考之方法参数关键字:params、ref及out
- C#中ref和out的使用小结