protected static BindingFlags GetBindingFlags(TrackClassAttribute attribute) { const BindingFlags instanceAnyVisibilityFlag = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; var bindingFlags = (attribute == null || attribute.IncludeBaseProperties) ? instanceAnyVisibilityFlag : instanceAnyVisibilityFlag | BindingFlags.DeclaredOnly; return bindingFlags; }
private bool IsEligibleProperty(PropertyInfo property, TrackClassAttribute trackClassAttr) { var attrs = property.GetCustomAttributes(typeof(TrackMemberAttribute), false); var trackMemberAttr = (TrackMemberAttribute)(attrs.Length == 0 ? null : attrs[0]); if (trackMemberAttr != null) return !trackMemberAttr.IsExcluded; return ((trackClassAttr == null || !trackClassAttr.RequireExplicitMarking) && property.GetGetMethod(true).IsPublic); }