AspNetEdit.Editor.Persistence.ControlPersister.HasInnerProperties C# (CSharp) Method

HasInnerProperties() private static method

private static HasInnerProperties ( object component ) : bool
component object
return bool
        private static bool HasInnerProperties(object component)
        {
            if (component == null)
                throw new ArgumentNullException ("component");

            //Do we have child controls as inner content of control?
            PersistChildrenAttribute persAtt = TypeDescriptor.GetAttributes (component)[typeof(PersistChildrenAttribute)] as PersistChildrenAttribute;
            if (persAtt != null && persAtt.Persist && (component is Control))
            {
                return true;
            }
            //We don't, so we're going to have to go though the properties
            else
            {
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (component);
                foreach (PropertyDescriptor prop in properties)
                {
                    //check whether we're serialising it
                    if (prop.SerializationVisibility == DesignerSerializationVisibility.Hidden
                        || prop.DesignTimeOnly
                        //|| !prop.ShouldSerializeValue(component) //confused by collections....
                        || prop.Converter == null)
                        continue;

                    PersistenceModeAttribute modeAttrib = prop.Attributes[typeof (PersistenceModeAttribute)] as PersistenceModeAttribute;
                    if (modeAttrib == null || modeAttrib.Mode == PersistenceMode.Attribute)
                        continue;

                    return true;
                }
            }

            return false;
        }