public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (location != null)
{
DemandForUserLocationOrEvidence();
}
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
XmlTypeMapping mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
TempAssembly tempAssembly = XmlSerializer.GenerateTempAssembly(mapping, type, defaultNamespace, location);
return (XmlSerializer)tempAssembly.Contract.TypedSerializers[mapping.Key];
}