O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

XmlConvert

Synopsis

This type is used to convert XML elements into other, non-XML types, such as CLR objects. In particular, it is used to convert XSD types into CLR types, for easy transformation of schema-valid XML documents into C# objects and back again. It is also used within a variety of other areas, including ADO.NET (for automatic conversion of XML documents into relational tables and rows).

For the most part, C# programmers use this type indirectly as part of the .NET Web Services stack, or else directly in order to convert between XML documents and CLR objects (as part of a home-grown XML-to-RDBMS system, for example).

Note that although a constructor is provided, all methods of any interest are declared “static,” and therefore require no instance to use. In essence, this type is a collection of C-style functions.

public class XmlConvert {
// Public Constructors
   public method XmlConvert();  
// Public Static Methods
   public static method string DecodeName(string name);  
   public static method string EncodeLocalName(string name);  
   public static method string EncodeName(string name);  
   public static method string EncodeNmToken(string name);  
   public static method bool ToBoolean(string s);  
   public static method byte ToByte(string s);  
   public static method char ToChar(string s);  
   public static method DateTime ToDateTime(string s);  
   public static method DateTime ToDateTime(string s, 
        string format);  
   public static method DateTime ToDateTime(string s, 
        string[] formats); public static method ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required