相关疑难解决方法(0)

XML Serialize boolean为0和1

XML Schema Part 2指定定义为boolean的数据类型的实例可以具有以下合法文字{true,false,1,0}.例如,在反序列化时,以下XML将布尔属性"Emulate"设置为true.

<root>
    <emulate>1</emulate>
</root>
Run Code Online (Sandbox Code Playgroud)

但是,当我将对象序列化回XML时,我得到的true不是数值.我的问题是,有没有办法可以控制XML中的布尔表示?

c# xml schema serialization constraints

24
推荐指数
2
解决办法
2万
查看次数

标签 统计

c# ×1

constraints ×1

schema ×1

serialization ×1

xml ×1