摘要: 一、out的用法1,当调用有out定义的参数的方法时,其该传递的变量不需要在传递之前进行初始化,但需要被调用的方法返回之前赋值。代码事例如下:class OutExample{ static void Method(out int i) { i = 44; } static void Main() { int value; Method(out value); // value is now 44 }}2,当方法重载时,其参数的变化不能是ref和out的变化。3,当希望方法返回多个值时,声明 out 方法很有用。使用 out 参数的方法仍然可以将变量用作返回类型,但它还可以将一个或多个对象作为 阅读全文
posted @ 2013-04-25 15:44 namehwh 阅读(166) 评论(0) 推荐(0) 编辑