public static MemberInfox GetPropertyInfox(object obj, string PropertyPath, bool SearchForPriviteFieldInCasePublicFieldIsReadOnly = true) { MemberInfox info = null; foreach (var partName in (PropertyPath + "").Split('.'))//For nested properties like a.Name { info = new MemberInfox(obj, partName, SearchForPriviteFieldInCasePublicFieldIsReadOnly); if (!info.MemberExists) return info; obj = info.GetValue(); } return info; }
private bool IsEqualDefaut(MemberInfox property) { try { if (!Utility.IsSimpleType(property.ValueType)) return false; var val = property.GetValue(); object att = property.GetCustomAttributes(typeof(DefaultValueAttribute)); if (att != null) return object.Equals(val, (att as DefaultValueAttribute).Value); return object.Equals(val, Utility.GetDefault(property.MemberType)); } catch { } return true; }