How to fix IFragmentCapableXmlDictionaryWriter.WriteFragment example

Nicholas Piazza 536 Reputation points

In the Microsoft documentation for System.Xml, there is an example for IFragmentCapableXmlDictionaryWriter.WriteFragment at URL 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?

Microsoft Technologies based on the .NET software framework.
3,605 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 114.5K Reputation points

    Probably the example is for .NET Framework.

    Try another writer:

    XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter( stream );