Esempio n. 1
0
        public static bool IsAutoProperty(PropertyDefinition propDef)
        {
            if (propDef.GetMethod != null && Helpers.IsScript(propDef.GetMethod))
            {
                return(false);
            }

            if (propDef.SetMethod != null && Helpers.IsScript(propDef.SetMethod))
            {
                return(false);
            }

            if (propDef.GetMethod == null || propDef.SetMethod == null)
            {
                return(false);
            }
            if (AttributeHelper.HasCompilerGeneratedAttribute(propDef.GetMethod))
            {
                return(true);
            }

            var typeDef = propDef.DeclaringType;

            return(typeDef != null && typeDef.Fields.Any(f => !f.IsPublic && !f.IsStatic && f.Name.Contains("BackingField") && f.Name.Contains("<" + propDef.Name + ">")));
        }