摘要: public static void DisplayString(params string[] strNames)//好像对于本例来说去掉params效果也一样,但是加上params后直接使用传递的参数列表 { foreach (var item in strNames) { Console.WriteLine(item.ToString()); } } public static void ParamsTest( string[] names) { for (int i = 0; i < names.Length;i++ ) { Console.WriteLine(names[i]) 阅读全文
posted @ 2013-03-28 18:53 Predator 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 鄙人初学反射特性动手练习了一下:分三步:首先自定义MeetingRecordAttribute类; 然后在其它的类中引用使用该特性; 最后访问该特性的基本信息;(-)具体的源代码如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConAttribute{ //AllowMultiple=true表示这个特性可以多次应用到同一应用程序元素上,Interited=true表示子类可以具有这个特性 [AttributeUsageAttribute(Attribu 阅读全文
posted @ 2013-03-28 18:45 Predator 阅读(156) 评论(0) 推荐(0) 编辑
摘要: string className = System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName; //获取正在运行方法所在类的类型名字Console.WriteLine(className);//输出ConAttribute.Program 阅读全文
posted @ 2013-03-28 15:32 Predator 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 以前学数据结构的时候,都是用C/C++编写的,现在正学C#,打算用C#玩一下数据结构的算法。单链表的练习如下using System;using System.Threading;using System.Collections.Generic;using System.Runtime.Remoting.Contexts;using System.Reflection;using System.Diagnostics;namespace ConTest{ class Programe { struct People { ... 阅读全文
posted @ 2013-03-27 23:31 Predator 阅读(253) 评论(0) 推荐(0) 编辑