internal static XmlSerializer CreateXmlSerializer(Type self, string defaultNamespace, bool includeTypeInNamespace = false) { var usedNamespace = includeTypeInNamespace?SerializationHelper.BuildNamespace(defaultNamespace, self):defaultNamespace; XmlSerializer serializer; if (SerializerCache.TryGetValue(GetSerializerKey(self, usedNamespace), out serializer)) { return(serializer); } serializer = new XmlSerializer(self, usedNamespace); SerializerCache.TryAdd(GetSerializerKey(self, usedNamespace), serializer); return(serializer); }