共用方式為


對應 XML 資料型別至 CLR 類型

更新: November 2007

下表說明 XML 資料型別及 Common Language Runtime (CLR) 型別之間的預設對應。

下表說明 XML 資料型別至 CLR 型別的預設對應。

注意事項:

xs 及 xdt 前置詞分別對應至 http://www.w3.org/2001/XMLSchema 及 http://www.w3.org/2003/05/xpath-datatypes 命名空間 URI。

XML 型別

CLR 型別

xs:anyURI

Uri

xs:base64Binary

Byte[]

xs:boolean

Boolean

xs:byte

SByte

xs:date

DateTime

xs:dateTime

DateTime

xs:decimal

Decimal

xs:double

Double

xs:duration

TimeSpan

xs:ENTITIES

String[]

xs:ENTITY

String

xs:float

Single

xs:gDay

DateTime

xs:gMonthDay

DateTime

xs:gYear

DateTime

xs:gYearMonth

DateTime

xs:hexBinary

Byte[]

xs:ID

String

xs:IDREF

String

xs:IDREFS

String[]

xs:int

Int32

xs:integer

Decimal

xs:language

String

xs:long

Int64

xs:gMmonth

DateTime

xs:Name

String

xs:NCName

String

xs:negativeInteger

Decimal

xs:NMTOKEN

String

xs:NMTOKENS

String[]

xs:nonNegativeInteger

Decimal

xs:nonPositiveInteger

Decimal

xs:normalizedString

String

xs:NOTATION

XmlQualifiedName

xs:positiveInteger

Decimal

xs:QName

XmlQualifiedName

xs:short

Int16

xs:string

String

xs:time

DateTime

xs:token

String

xs:unsignedByte

Byte

xs:unsignedInt

UInt32

xs:unsignedLong

UInt64

xs:unsignedShort

UInt16

xdt:dayTimeDuration

TimeSpan

xdt:yearMonthDuration

TimeSpan

xdt:untypedAtomic

String

xdt:anyAtomicType

Object

xs:anySimpleType

String

Document node

XPathNavigator

Element node

XPathNavigator

Attribute node

XPathNavigator

Namespace node

XPathNavigator

Text node

XPathNavigator

Comment node

XPathNavigator

Processing instruction node

XPathNavigator

請參閱

其他資源

System.Xml 類別中的型別支援