public void MemberAccessWithReflection() { var obj = new PropsOnClass { A = 123, B = "abc", C = _now, D = null }; DateTime value = (DateTime)typeof(PropsOnClass).GetProperty("C").GetValue(obj); Assert.AreEqual(_now, value); }
public void StaticMemberAccessWithFastMember_ObjectAccessor() { var obj = new PropsOnClass { A = 123, B = "abc", C = _now, D = null }; var accessor = TypeAccessor.Create(typeof(PropsOnClass)); int value = (int)accessor[obj, "Count"]; Assert.AreEqual(1, value); }
public void MemberAccessWithFastMember_ObjectAccessor() { var obj = new PropsOnClass { A = 123, B = "abc", C = _now, D = null }; var accessor = ObjectAccessor.Create(obj); var value = (DateTime)accessor["C"]; Assert.AreEqual(_now, value); }
public void MemberAccessWithFastMember_TypeAccessor() { var obj = new PropsOnClass { A = 123, B = "abc", C = _now, D = null }; var accessor = TypeAccessor.Create(typeof(PropsOnClass)); DateTime value = (DateTime)accessor[obj, "C"]; Assert.AreEqual(_now, value); }