Data Member Order
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/data-member-order
In some applications, it is useful to know the order in which data from the various data members is sent or is expected to be received (such as the order in which data appears in the serialized XML).
Sometimes it may be necessary to change this order.
This topic explains the ordering rules.
Basic Rules
The basic rules for data ordering include:
If a data contract type is a part of an inheritance hierarchy, data members of its base types are always first in the order.
Next in order are the current type’s data members that do not have the Order property of the DataMemberAttribute attribute set, in alphabetical order.
Next are any data members that have the Order property of the DataMemberAttribute attribute set. These are ordered by the value of the
Orderproperty first and then alphabetically if there is more than one member of a certainOrdervalue. Order values may be skipped.
Alphabetical order is established by calling the CompareOrdinal method.
用途
1.序列化的时候,指定顺序,和xml匹配
2.序列化的时候,属性之间有依赖关系,比如A属性在set的时候,有自己的logic,去设置了B属性。
这种情况下,必须先序列化A属性,再序列化B属性。
when a property has a logic for set or get,then apply data member attribute to field
Data Member Order的更多相关文章
- C++ Data Member内存布局
如果一个类只定义了类名,没定义任何方法和字段,如class A{};那么class A的每个实例占用1个字节的内存,编译器会会在这个其实例中安插一个char,以保证每个A实例在内存中有唯一的地址,如A ...
- Effective C# 学习笔记(原则一:始终能的使用属性(property),而不是可直接访问的Data Member)
原则一:始终能的使用属性(property),而不是可直接访问的Data Member Always use properties instead of accessible data memb ...
- 3.1 Data Member的绑定
文章开始提出了一段示例代码,并讨论了返回哪个x的问题.然后 a) 给出了我们普遍认为正确的回答,并肯定了这个想法: b) 提醒大家,这在以前的编译器实现中,并非正确. 在早期的实现中,首 ...
- warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
struct test{int a=1111111; }test; vincentdeMacBook-Air:datasturte vincent$ g++ struct.cpp -o structp ...
- 始终使用属性(Property),而不是字段(Data Member)
1.始终使用属性(Property),而不是字段(Data Member) C# 属性已经晋升为一等公民,如果你的类中还有public的字段,Stop.访问属性和字段的方式是一样的,但是属性是用方法( ...
- 数据框排序 data.frame order
# sorting examples using the mtcars datasetattach(mtcars) # sort by mpgnewdata <- mtcars[order(mp ...
- TCP carries HTTP data in order, and without corruption
wTCP/IP承载几乎所有的HTTP通信. HTTP The Definitive Guide
- Learning WCF Chapter2 Data Contracts
A data contract describes how CLR types map to XSD schema definitions. Data contracts are the prefer ...
- R语言 data.frame 大全
A data frame is used for storing data tables. It is a list of vectors of equal length. For example, ...
随机推荐
- WinServer-IIS初始安装及发布网站
\aspnet_regiis.exe –i 还有非常重要的一步就是给发布文件夹设置权限,到底设置那一个用户的权限我也没有弄清楚,大概是IIS_IUSERS或者IUSR用户就可以了,我设置完了之后没有反 ...
- 关于thinkpadU盘系统盘启动不了解决方法
http://www.laomaotao.org/softhelp/bios/382.html(原文章地址,比较全面) thinkpad笔记本uefi无法启动详细解决教程 最近有个别用户反映说thin ...
- 深入理解Dalvik虚拟机- 解释器的执行机制
Dalvik的指令运行是解释器+JIT的方式,解释器就是虚拟机来对Javac编译出来的字节码,做译码.运行,而不是转化成CPU的指令集.由CPU来做译码,运行.可想而知.解释器的效率是相对较低的,所以 ...
- C++11时间具体解释
转载请注明出处:http://blog.csdn.net/luotuo44/article/details/46854229 C++ 11添加了三个与时间相关的类型:时间段.时钟.时间点. 以史为鉴 ...
- selenium的报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class names not permitted
报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class ...
- java基础——static keyword小节
static 用于修饰成员 修饰成员变量和成员函数 被修饰过的成员的特点: 1.随着类的载入而载入 2.优先于对象而存在 3.被全部对象所共享 4.能够直接被类名调用
- xBIM 高级03 更改日志创建
系列目录 [已更新最新开发文章,点击查看详细] 模型中发生的每一个变化都是事务的一部分,这是我们设计的核心.所有事务都是由 IModel 的实现创建的,并且从中被弱引用,因此当使用 using ...
- BZOJ 2190 欧拉函数
思路: 递推出来欧拉函数 搞个前缀和 sum[n-1]*2+3就是答案 假设仪仗队是从零开始的 视线能看见的地方就是gcd(x,y)=1的地方 倒过来一样 刨掉(1,1) 就是ans*2+1 再加一下 ...
- spark集群体系结构
- CSS中元素各种居中方法(思维导图)
前言 用思维导图的方式简单总结一下各种元素的居中方法,如下图: 补充一下: table自带功能 100% 高度的 afrer before 加上 inline block优化 div 装成 table ...