标签:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace Reflection { class Program { static void Main(string[] args) { string s = "Hello Reflection"; Type t = s.GetType(); Console.WriteLine(t.FullName); Type t2 = Type.GetType("System.String",false,true); Console.WriteLine(t2.FullName); Type t3 = typeof(string); Console.WriteLine(t3.FullName); // GetMehtods(t); Console.WriteLine("Join method:{0}",t.GetMethod("Copy")); GetMehtods(t,BindingFlags.Public|BindingFlags.Instance); //GetFields().GetProperites() Console.ReadLine(); } public static void GetMehtods(Type t,BindingFlags f) { MethodInfo[] mi = t.GetMethods(f); foreach (MethodInfo m in mi) { Console.WriteLine("{0}",m.Name); } } } }
标签:
原文地址:http://www.cnblogs.com/heisaijuzhen/p/4499258.html