public void CanGetNextedObjectValue() { var val = new { A = new { B = 4 } }; var getted = CommonMacros.GetPropValue(val, "A.B"); Assert.Equal(4, getted); }
public static bool PropertyExistsAndEvalToTrue(object obj, string propName) { var val = CommonMacros.GetPropValue(obj, propName); if (val is bool) { return((bool)val); } if (val is bool?) { return(((bool?)val).GetValueOrDefault()); } return(false); }
public static object LoadProp(object obj, string propName) { return(CommonMacros.GetPropValue(obj, propName)); }