Hi, I have this code that is called thousands of times and I need to optimize it for performance. I thought about caching xmlQualifiedNames but it's not good enough. any ideas ?
private static string GetPrefixForNamespace(string ns, XmlSchema schemaDocument)
{
string prefix = null;
XmlQualifiedName[] xmlQualifiedNames = schemaDocument.Namespaces.ToArray();
foreach (XmlQualifiedName qn in xmlQualifiedNames)
{
if (ns == qn.Namespace)
{
prefix = qn.Name;
break;
}
}
return prefix;
}