Probably the example is for .NET Framework.
Try another writer:
XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter( stream );
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In the Microsoft documentation for System.Xml, there is an example for IFragmentCapableXmlDictionaryWriter.WriteFragment at URL https://learn.microsoft.com/en-us/dotnet/api/system.xml.ifragmentcapablexmldictionarywriter.writefragment?view=net-8.0. When I implement that example, it always takes the path that leads to the WriteLine message "This writer doesn't support fragments." How can that example be rewritten to support fragment writing so I can see how it is actually supposed to work?
Probably the example is for .NET Framework.
Try another writer:
XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter( stream );