public void GetFieldRecursively_Correct() { var foo = new Foo2(); foo.GetType().GetFieldRecursively("bar").GetValue(foo).Should().Be("Bar"); (typeof(Foo2).GetFieldRecursively("staticBar").GetValue(foo) as string).Should().Be("StillBar"); }
public static void Main() { Console.WriteLine("Hello World"); var a = new Foo(); var b = new Foo2(); var res = a.GetType().CustomAttributes; foreach (var i in res) { Console.WriteLine(i); } var res2 = b.GetType().CustomAttributes; foreach (var i in res2) { Console.WriteLine(i); } }