Data Type Support between XML Schema (XSD) Types and .NET Framework Types

The data types section of the World Wide Web Consortium (W3C) XML Schema Recommendation, available at, lists the data types that can be used in XML Schemas.

These data types are represented as instances of the XmlSchemaDatatype class, which has ValueType and TokenizedType properties. These properties respectively are the name of the type as specified in the XML 1.0 Recommendation, and the name of the .NET Framework type that represents it.

The XmlSchemaElement and XmlSchemaAttribute classes have ElementType and AttributeType properties that contain an XmlSchemaDatatype for the XML Schema type of the element or attribute after validation and compilation of the schema.

The following table shows the XML Schema data types and their corresponding .NET Framework type support.

XML Schema (XSD) type .NET Framework type
anyURI System.Uri
base64Binary System.Byte[]
Boolean System.Boolean
Byte System.SByte
Date System.DateTime
dateTime System.DateTime
decimal System.Decimal
Double System.Double
duration System.TimeSpan
ENTITIES System.String[]
ENTITY System.String
Float System.Single
gDay System.DateTime
gMonthDay System.DateTime
gYear System.DateTime
gYearMonth System.DateTime
hexBinary System.Byte[]
ID System.String
IDREF System.String
IDREFS System.String[]
int System.Int32
integer System.Decimal
language System.String
long System.Int64
month System.DateTime
Name System.String
NCName System.String
negativeInteger System.Decimal
NMTOKEN System.String
NMTOKENS System.String[]
nonNegativeInteger System.Decimal
nonPositiveInteger System.Decimal
normalizedString System.String
NOTATION System.String
positiveInteger System.Decimal
QName System.Xml.XmlQualifiedName
short System.Int16
string System.String
time System.DateTime
timePeriod System.DateTime
token System.String
unsignedByte System.Byte
unsignedInt System.UInt32
unsignedLong System.UInt64
unsignedShort System.UInt16

See Also

XML Schema Object Model (SOM)