2 // System.Web.UI.ParseChildrenAttribute.cs
5 // Duncan Mak (duncan@ximian.com)
6 // Gonzalo Paniagua (gonzalo@ximian.com)
8 // (C) 2002 Ximian, Inc. (http://www.ximian.com
13 namespace System.Web.UI {
15 [AttributeUsage (AttributeTargets.Class)]
16 public sealed class ParseChildrenAttribute : Attribute
18 bool childrenAsProperties;
19 string defaultProperty;
20 public static readonly ParseChildrenAttribute Default = new ParseChildrenAttribute ();
23 public ParseChildrenAttribute ()
25 childrenAsProperties = false;
29 public ParseChildrenAttribute (bool childrenAsProperties)
31 this.childrenAsProperties = childrenAsProperties;
32 this.defaultProperty = "";
35 public ParseChildrenAttribute (bool childrenAsProperties,
36 string defaultProperty)
38 this.childrenAsProperties = childrenAsProperties;
39 if (childrenAsProperties)
40 this.defaultProperty = defaultProperty;
43 public bool ChildrenAsProperties {
45 get { return childrenAsProperties; }
47 set { childrenAsProperties = value; }
50 public string DefaultProperty {
51 get { return defaultProperty; }
53 set { defaultProperty = value; }
56 public override bool Equals (object obj)
58 if (!(obj is ParseChildrenAttribute))
61 ParseChildrenAttribute o = (ParseChildrenAttribute) obj;
62 if (childrenAsProperties == o.childrenAsProperties){
63 if (childrenAsProperties == false)
65 return (defaultProperty == o.DefaultProperty);
70 public override int GetHashCode ()
72 return base.GetHashCode ();
75 public override bool IsDefaultAttribute ()
77 return Equals (Default);