<PackageReference Include="System.Xml.ReaderWriter" Version="4.0.11-beta-23409" />

NamespaceHandling

public enum NamespaceHandling
Specifies whether to remove duplicate namespace declarations in the XmlWriter.
Default = 0

Specifies that duplicate namespace declarations will not be removed.

Specifies that duplicate namespace declarations will be removed. For the duplicate namespace to be removed, the prefix and the namespace must match.