C# 反射
来源:互联网 发布:意大利火车时刻表软件 编辑:程序博客网 时间:2024/05/29 02:45
using System;using System.Reflection;namespace ConsoleApplication20{ class Program { static void Main(string[] args) { /* string n = "grayworm"; Type t = n.GetType(); foreach (MemberInfo mi in t.GetMembers()) { Console.WriteLine("{0}/t{1}", mi.MemberType, mi.Name); } */ AA aa = new AA(1,2); Type t = aa.GetType(); foreach (MemberInfo mi in t.GetMembers()) { Console.WriteLine("{0}/{1}", mi.MemberType, mi.Name); } ConstructorInfo[] ci = t.GetConstructors(); //获取类的所有构造函数 foreach (ConstructorInfo c in ci) //遍历每一个构造函数 { ParameterInfo[] ps = c.GetParameters(); //取出每个构造函数的所有参数 foreach (ParameterInfo pi in ps) //遍历并打印所该构造函数的所有参数 { Console.Write(pi.ParameterType.ToString() + " " + pi.Name + ","); } Console.WriteLine(); } } } class AA { public int a { get; set; } public AA(int a,int b) { this.a = a + b; } public static int A(int x) { return x + 1; } }}
0 0
- C# 反射
- C#反射
- C# 反射
- C#反射
- C#反射
- C# 反射
- C#反射
- c#反射
- c#反射
- C#反射
- c# 反射
- C# 反射
- c# 反射
- C#反射
- C#反射
- C#反射
- C# 反射
- C#反射
- C# 委托的使用(指向函数的指针)
- $_SERVER只能在apache服务器下使用
- 项目经验之springmvc单元测试
- undo表空间概述
- Andriod更换背景颜色
- C# 反射
- 网页优化
- PHP - ArrayAccess接口详解
- 【bzoj3564】 [SHOI2014]信号增幅仪
- 第八道ACM程序题
- iOS Crash收集框架
- C# 使用Linq
- 【模态窗】制作适合手机页面的模态弹窗
- 自定义View之TitleBar