コード例 #1
0
        public virtual CustomPropertyDescriptor Find(string name, bool ignoreCase)
        {
            CustomPropertyDescriptorCollection descriptors = this;

            lock (descriptors)
            {
                CustomPropertyDescriptor descriptor = null;
                if ((this.cachedFoundProperties == null) || (this.cachedIgnoreCase != ignoreCase))
                {
                    this.cachedIgnoreCase      = ignoreCase;
                    this.cachedFoundProperties = new HybridDictionary(ignoreCase);
                }
                object obj2 = this.cachedFoundProperties[name];
                if (obj2 != null)
                {
                    return((CustomPropertyDescriptor)obj2);
                }
                for (int i = 0; i < this.propCount; i++)
                {
                    if (ignoreCase)
                    {
                        if (!string.Equals(this.properties[i].Name, name, StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        this.cachedFoundProperties[name] = this.properties[i];
                        descriptor = this.properties[i];
                        break;
                    }
                    if (this.properties[i].Name.Equals(name))
                    {
                        this.cachedFoundProperties[name] = this.properties[i];
                        descriptor = this.properties[i];
                        break;
                    }
                }
                return(descriptor);
            }
        }
コード例 #2
0
 public PropertyDescriptorEnumerator(CustomPropertyDescriptorCollection owner)
 {
     this.owner = owner;
 }