object IDictionary.this[object key] {
get {
if (key is string) {
return this[(string)key];
}
return null;
}
set {
if (readOnly) {
throw new NotSupportedException();
}
if (value != null && !(value is PropertyDescriptor)) {
throw new ArgumentException("value");
}
int index = -1;
if (key is int) {
index = (int)key;
if (index < 0 || index >= propCount) {
throw new IndexOutOfRangeException();
}
}
else if (key is string) {
for (int i = 0; i < propCount; i++) {
if (properties[i].Name.Equals((string)key)) {
index = i;
break;
}
}
}
else {
throw new ArgumentException("key");
}
if (index == -1) {
Add((PropertyDescriptor)value);
}
else {
EnsurePropsOwned();
properties[index] = (PropertyDescriptor)value;
if (cachedFoundProperties != null && key is string) {
cachedFoundProperties[key] = value;
}
}
}
}