Exemplo n.º 1
0
        public ReflectPropertyDescriptor(Type componentClass, PropertyDescriptor oldReflectPropertyDescriptor, Attribute[] attributes) : base(oldReflectPropertyDescriptor, attributes)
        {
            this.state          = new BitVector32();
            this.componentClass = componentClass;
            this.type           = oldReflectPropertyDescriptor.PropertyType;
            if (componentClass == null)
            {
                throw new ArgumentException(SR.GetString("InvalidNullArgument", new object[] { "componentClass" }));
            }
            ReflectPropertyDescriptor descriptor = oldReflectPropertyDescriptor as ReflectPropertyDescriptor;

            if (descriptor != null)
            {
                if (descriptor.ComponentType == componentClass)
                {
                    this.propInfo              = descriptor.propInfo;
                    this.getMethod             = descriptor.getMethod;
                    this.setMethod             = descriptor.setMethod;
                    this.shouldSerializeMethod = descriptor.shouldSerializeMethod;
                    this.resetMethod           = descriptor.resetMethod;
                    this.defaultValue          = descriptor.defaultValue;
                    this.ambientValue          = descriptor.ambientValue;
                    this.state = descriptor.state;
                }
                if (attributes != null)
                {
                    foreach (Attribute attribute in attributes)
                    {
                        DefaultValueAttribute attribute2 = attribute as DefaultValueAttribute;
                        if (attribute2 != null)
                        {
                            this.defaultValue = attribute2.Value;
                            this.state[BitDefaultValueQueried] = true;
                        }
                        else
                        {
                            AmbientValueAttribute attribute3 = attribute as AmbientValueAttribute;
                            if (attribute3 != null)
                            {
                                this.ambientValue = attribute3.Value;
                                this.state[BitAmbientValueQueried] = true;
                            }
                        }
                    }
                }
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            AmbientValueAttribute attribute = obj as AmbientValueAttribute;

            if (attribute == null)
            {
                return(false);
            }
            if (this.value != null)
            {
                return(this.value.Equals(attribute.Value));
            }
            return(attribute.Value == null);
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            AmbientValueAttribute other = obj as AmbientValueAttribute;

            if (other != null)
            {
                if (_value != null)
                {
                    return(_value.Equals(other.Value));
                }
                else
                {
                    return(other.Value == null);
                }
            }
            return(false);
        }