internal XmlSchemaObject AddItem(XmlSchemaObject item, XmlQualifiedName qname, XmlSchemas schemas) {
if (item == null)
return null;
if (qname == null || qname.IsEmpty)
return null;
string key = item.GetType().Name + ":" + qname.ToString();
ArrayList list = (ArrayList)ObjectCache[key];
if (list == null) {
list = new ArrayList();
ObjectCache[key] = list;
}
for (int i = 0; i < list.Count; i++) {
XmlSchemaObject cachedItem = (XmlSchemaObject)list[i];
if (cachedItem == item)
return cachedItem;
if (Match(cachedItem, item, true)) {
return cachedItem;
}
else {
Warnings.Add(Res.GetString(Res.XmlMismatchSchemaObjects, item.GetType().Name, qname.Name, qname.Namespace));
Warnings.Add("DEBUG:Cached item key:\r\n" + (string)looks[cachedItem] + "\r\nnew item key:\r\n" + (string)looks[item]);
}
}
// no match found we need to insert the new type in the cache
list.Add(item);
return item;
}