private bool ExtExists(string ext, ConfigurationElementCollection handlerCollection, out int index) { bool exists = false; index = -1; foreach (ConfigurationElement element in handlerCollection) { if (string.Compare(element.Schema.Name, "add", true) != 0 || string.Compare(element["path"].ToString(), ext, true) != 0) { continue; } index = handlerCollection.IndexOf(element); exists = true; break; } return(exists); }