2.2.3 Mapping .NET Framework Types to [XMLSCHEMA2] Types

The following table details the mapping from Microsoft .NET Framework types to types that are defined in [XMLSCHEMA2].

For some .NET Framework types, the mapping to the [XMLSCHEMA2] type is not sufficient to fully define the serialization format. In these cases, additional information is provided for what MUST be specified to add to the XML schema and/or what MUST be specified for the layout of the data.

Types that are not listed in the following table can be used in the DiffGram. However, their serialization formats are outside the scope of this document.

.NET Framework type

[XMLSCHEMA2] type

Char

The XML schema of a Char MUST be written as restriction of a string type where the length = 1, as in the following example.

 <xs:simpleType>       
      <xs:restriction base="xs:string">          
      <xs:length value="1" />     
 </xs:restriction></xs:simpleType>

String

String

Boolean

Boolean

Double

Double

Decimal

Decimal

TimeSpan

Duration

Byte[]

base64Binary

Single

Float

Int64

Long

Int32

Int

Int16

Short

Sbyte

Byte

UInt64

unsignedLong

UInt32

unsignedInt

UInt16

unsignedShort

Byte

unsignedByte

DateTime

dateTime

Guid

String

Any Guid instance MUST be serialized into a string form as defined by the following Augmented Backus-Naur Form (ABNF).

guidLiteral   = 8*HEXDIG "-" 4*HEXDIG "-" 4*HEXDIG "-" 12*HEXDIG

Uri

anyUri

BigInteger

Anytype

Any BigInteger value MUST be serialized into the same form as the XML Schema (XSD) type integer as specified in [XMLSCHEMA2].

SqlBinary

hexBinary

SqlBoolean

Boolean

SqlByte

Byte

SqlBytes

base64Binary

SqlChars

String

SqlDateTime

dateTime

SqlDecimal

Decimal

SqlDouble

Double

SqlGuid

Guid

SqlInt16

Short

SqlInt32

Int

SqlInt64

Long

SqlMoney

Decimal

SqlSingle

Float

SqlString

String

SqlXml

Anytype