2 // System.ComponentModel.MemberDescriptor.cs
5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) Ximian, Inc. http://www.ximian.com
10 namespace System.ComponentModel {
12 public abstract class MemberDescriptor {
15 AttributeCollection attrCollection;
17 protected MemberDescriptor (string name, Attribute [] attrs)
23 protected MemberDescriptor (MemberDescriptor reference, Attribute [] attrs)
25 name = reference.name;
29 protected MemberDescriptor (string name)
34 protected MemberDescriptor (MemberDescriptor reference)
36 name = reference.name;
37 attrs = reference.attrs;
40 protected virtual Attribute [] AttributeArray {
50 public virtual AttributeCollection Attributes
53 if (attrCollection == null)
54 attrCollection = new AttributeCollection (attrs);
55 return attrCollection;
59 public virtual string Category {
61 return ((CategoryAttribute) Attributes [typeof (CategoryAttribute)]).Category;
65 public virtual string Description {
67 foreach (Attribute attr in attrs){
68 if (attr is DescriptionAttribute)
69 return ((DescriptionAttribute) attr).Description;
76 public virtual bool DesignTimeOnly {
78 foreach (Attribute attr in attrs){
79 if (attr is DesignOnlyAttribute)
80 return ((DesignOnlyAttribute) attr).IsDesignOnly;
88 // FIXME: Is there any difference between DisplayName and Name?
90 [MonoTODO ("Does this diff from Name ?")]
91 public virtual string DisplayName {
97 public virtual string Name {
103 public virtual bool IsBrowsable {
105 foreach (Attribute attr in attrs){
106 if (attr is BrowsableAttribute)
107 return ((BrowsableAttribute) attr).Browsable;
114 protected virtual int NameHashCode {
116 return name.GetHashCode ();