c# – 在没有引号的情况下序列化int类型
发布时间:2020-12-15 23:46:02 所属栏目:百科 来源:网络整理
导读:我有以下类来序列化: [Serializable]public class LabelRectangle { [XmlAttribute] public int X { get; set; } [XmlAttribute] public int Y { get; set; } [XmlAttribute] public int Width { get; set; } [XmlAttribute] public int Height { get; set;
我有以下类来序列化:
[Serializable] public class LabelRectangle { [XmlAttribute] public int X { get; set; } [XmlAttribute] public int Y { get; set; } [XmlAttribute] public int Width { get; set; } [XmlAttribute] public int Height { get; set; } } 它将被序列化,看起来像这样 <LabelRectangle X="15" Y="70" Width="10" Height="1" /> 但我想得到以下结果: <LabelRectangle X=15 Y=70 Width=10 Height=1 /> 这是序列化没有引号的int类型值.有可能吗?如果是的话? 解决方法
这将不再是一个格式良好的XML – 您定义了属性
[XmlAttribute] 属性值总是在引号!! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |