2010年8月7日

索引器

摘要: using System;public class IndexTest{ int[] arr = new int[100]; public int this[int index] { get { if (arr.Length == null||arr.Length==0) return 0; if (index < 0 || index > arr.Length) return 0; ... 阅读全文

posted @ 2010-08-07 23:22 椅望 阅读(124) 评论(1) 推荐(0) 编辑

传址out

摘要: using System;public class SimpleClass{ string str_origin; public string PassByReference(out string s) { s = "cba"; //必须在方法里进行初始化 s = s.ToUpper(); return s; } public static void Main() { SimpleClass s... 阅读全文

posted @ 2010-08-07 12:57 椅望 阅读(126) 评论(0) 推荐(0) 编辑

传值与ref传址

摘要: using System;public class SimpleClass{ public int PassByValue(int i) { i = i * 2; return i; } public string PassByValue(string s) { s = s.ToUpper(); return s; } public string PassByReference(ref stri... 阅读全文

posted @ 2010-08-07 01:23 椅望 阅读(140) 评论(0) 推荐(0) 编辑

导航