纸上得来终觉浅,绝知此事要躬行。

 

2010年7月14日

ref和out的使用方法

摘要: out 关键字会导致参数通过引用来传递。这与ref关键字类似,不同之处在于ref要求变量必须在传递之前进行初始化。若要使用 out 参数,方法定义和调用方法都必须显式使用 out 关键字。例如:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 class OutExample 2 { 3 static void Method(out int i) 4 { 5 i = 44; 6 } 7 stati... 阅读全文

posted @ 2010-07-14 18:25 JRoger 阅读(371) 评论(0) 推荐(0) 编辑

导航