public static void ReflectionTest05() { var fi = typeof(TestCls).GetField("aa"); var fi2 = typeof(TestCls).GetField("bb"); var a = new TestCls(); Console.WriteLine("aa=" + fi.GetValue(a)); Console.WriteLine("bb=" + fi2.GetValue(null)); fi.SetValue(a, 123); fi2.SetValue(null, 233); Console.WriteLine("aa=" + fi.GetValue(a)); Console.WriteLine("bb=" + fi2.GetValue(null)); a.foo(110); var arr = fi.GetCustomAttributes(false); foreach (var i in arr) { Console.WriteLine(i); } }