示例#1
0
        public override ProblemCollection Check(Member member)
        {
            if (!(member is Field) || member.IsStatic || member.IsPrivate)
            {
                return(null);
            }

            // If the declaring type has [Imported] applied, we have no choice but to allow the field to exist
            if (RuleUtilities.HasCustomAttribute(member.DeclaringType, _importedAttributeType))
            {
                return(null);
            }

            // If the type derives from Record, allow the field to exist
            if (member.DeclaringType.BaseType == _recordType)
            {
                return(null);
            }

            Problems.Add(new Problem(base.GetResolution(new object[] { member })));
            return(Problems);
        }