XuGang

记录一个程序员的成长

 

2010年3月12日

C# 关键字ref 和out 的详细区别

摘要: ref 和 out 的详细区别ref和out都是C#中的关键字,所实现的功能也差不多,都是指定一个参数按照引用传递。对于编译后的程序而言,它们之间没有任何区别,也就是说它们只有语法区别。总结起来,他们有如下语法区别:1、ref传进去的参数必须在调用前初始化,out不必,即:int i;SomeMethod( ref i );//语法错误SomeMethod( out i );//通过2、ref传进... 阅读全文

posted @ 2010-03-12 11:27 钢钢 阅读(960) 评论(2) 推荐(0)

基于类的封装[基础]

摘要: 基于类的封装Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceCon_1{classProgram{staticv... 阅读全文

posted @ 2010-03-12 11:06 钢钢 阅读(473) 评论(0) 推荐(0)

导航