private static XmlSchemaSet GetShemaSet(string ns) { return(Schemas.GetOrAdd( ns, nss => { XmlSchemaSet result = new XmlSchemaSet(); Assembly assembly = typeof(XmlParserExtensions).Assembly; string manifest = assembly.GetManifestResourceNames().SingleOrDefault(s => s.Contains(".xsd")); Stream stream = assembly.GetManifestResourceStream(manifest); result.Add(ns, new XmlTextReader(stream)); result.Compile(); return result; })); }