Search code examples
c#.netxmlconvert

How to backport .NET 4's XmlConvert.IsWhitespaceChar to .NET 3.5?


I need to backport some code that uses this method to .NET 3.5, and from Reflector I can't seem to discern what would be the correct way to provide my own C# implementation for it.

Any help?


Solution

  • That method uses an embedded resource named XmlCharType.bin, you can see it with Reflector. It is used by System.Xml.XmlCharType.get_Instance() to initialize the charProperties pointer. That same resource is present in 3.5 as well, you could use it the same way.

    Or take the lesser 3.5 approach:

    WhitespaceChars = new char[] { ' ', '\t', '\n', '\r' };