0
我想讓我的枚舉類具有名稱 - 值對。我必須在我的xsd中定義枚舉。在xsd中爲枚舉元素指定值
例如: 目前,我有我的XSD作爲
<xsd:simpleType name="ColorCode">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Red"/>
<xsd:enumeration value="Orange"/>
<xsd:enumeration value="LightGreen"/>
<xsd:enumeration value="DarkGreen"/>
<xsd:enumeration value="LightBlue"/>
<xsd:enumeration value="DarkBlue"/>
<xsd:enumeration value="DarkGrey"/>
<xsd:enumeration value="LightGrey"/>
</xsd:restriction>
</xsd:simpleType>
生成的代碼是:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
public enum ColorCode {
/// <remarks/>
Red,
/// <remarks/>
Orange,
/// <remarks/>
LightGreen,
/// <remarks/>
DarkGreen,
/// <remarks/>
LightBlue,
/// <remarks/>
DarkBlue,
/// <remarks/>
DarkGrey,
/// <remarks/>
LightGrey,
}
我如何定義我的xsd使生成的代碼是什麼如下:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
public enum ColorCode {
/// <remarks/>
Red = 0x12,
/// <remarks/>
Orange = 0x13,
/// <remarks/>
LightGreen = 0x17,
/// <remarks/>
DarkGreen=0x20,
/// <remarks/>
LightBlue=0x40,
/// <remarks/>
DarkBlue=0x50,
/// <remarks/>
DarkGrey0x90,
/// <remarks/>
LightGrey=0x190,
}