AspNetEdit.Editor.Persistence.ControlPersister.ProcessAttribute C# (CSharp) Метод

ProcessAttribute() приватный статический Метод

Writes an attribute to an HtmlTextWriter if it needs serializing
private static ProcessAttribute ( PropertyDescriptor prop, object o, System.Web.UI.HtmlTextWriter writer, string prefix ) : bool
prop System.ComponentModel.PropertyDescriptor
o object
writer System.Web.UI.HtmlTextWriter
prefix string
Результат bool
        private static bool ProcessAttribute(PropertyDescriptor prop, object o, HtmlTextWriter writer, string prefix)
        {
            //check whether we're serialising it
            if (prop.SerializationVisibility == DesignerSerializationVisibility.Hidden
                || prop.DesignTimeOnly
                || prop.IsReadOnly
                || !prop.ShouldSerializeValue (o)
                || prop.Converter == null
                || !prop.Converter.CanConvertTo (typeof(string)))
                return false;

            bool foundAttrib = false;

            //is this an attribute? If it's content, we deal with it later.
            PersistenceModeAttribute modeAttrib = prop.Attributes[typeof (PersistenceModeAttribute)] as PersistenceModeAttribute;
            if (modeAttrib == null || modeAttrib.Mode == PersistenceMode.Attribute)
            {
                if (prop.SerializationVisibility == DesignerSerializationVisibility.Visible) {
                    if (prefix == string.Empty)
                        writer.WriteAttribute (prop.Name, prop.Converter.ConvertToString (prop.GetValue (o)));
                    else
                        writer.WriteAttribute (prefix + "-" + prop.Name, prop.Converter.ConvertToString (prop.GetValue(o)));
                    foundAttrib = true;
                }
                //recursively handle subproperties
                else if (prop.SerializationVisibility == DesignerSerializationVisibility.Content) {
                    object val = prop.GetValue (o);
                    foreach (PropertyDescriptor p in prop.GetChildProperties (val))
                        if (ProcessAttribute (p, val, writer, prop.Name))
                            foundAttrib = true;
                }
            }
            return foundAttrib;
        }