其实会获取字段值,其它的也应该没问题了。^_^
using System; using System.Reflection; namespace ConsoleTest { class Program { static void Main(string[] args) { Cat c = new Cat(); c.name = "mao"; c.age = 1; ShowValues(c); Console.ReadLine(); } static void ShowValues(Cat c) { Type t = c.GetType(); foreach (FieldInfo f in t.GetFields()) { Console.WriteLine(t.InvokeMember(f.Name, BindingFlags.GetField, null, c, null).ToString ()); } } } public class Cat { public int age; public string name; public string CatName { get { return name; } } } }