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, ...
随机推荐
- 洛谷——P1886 滑动窗口|| POJ——T2823 Sliding Window
https://www.luogu.org/problem/show?pid=1886#sub || http://poj.org/problem?id=2823 题目描述 现在有一堆数字共N个数字( ...
- Eclipse配置Maven私服
Eclipse配置Maven私服 前言: 搭建Maven私有仓库的主要目的,是为了在团队多人开发时,只要内网的私有仓库有下载过依赖的jar包,就直接从私有仓库获取,不再通过外网的中央仓库.如果私服上面 ...
- HDU 2865
和上题一样,但K较大,不能直接用矩阵来写.这个矩阵必定是这个形式的. 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 分成对角线上元素B与非对角线上元素A k: 1 2 3 4 ... ...
- FPGA实现网络通信时的网络字节序问题
在上位机软件发送字符abcd 在鲨鱼上抓包 用逻辑分析仪从FPGA网络接收管脚分析 数据接收后存储在位宽为8bit的ram中 从ram中读32bitUDP数据为 64636261 依据以上那个现象, ...
- Light OJ 1317 Throwing Balls into the Baskets 概率DP
n个人 m个篮子 每一轮每一个人能够选m个篮子中一个扔球 扔中的概率都是p 求k轮后全部篮子里面球数量的期望值 依据全期望公式 进行一轮球数量的期望值为dp[1]*1+dp[2]*2+...+dp[ ...
- 《Head First 设计模式》学习笔记——适配器模式 + 外观模式
在ADO.NET中.对于我们从数据库中取出的数据都要放到一个DataSet中,无论你是Access的数据库,还是SQL的数据库,或者是Oracle的数据库都要放到DataSet中..NET中并没有提供 ...
- ANSI编码
ANSI编码 ANSI简介 不同的国家和地区制定了不同的标准,由此产生了 GB2312.GBK.Big5.Shift_JIS 等各自的编码标准.这些使用 1 至 4 个字节来代表一个字符的各种汉字延伸 ...
- maven/ssm框架搭建
好久没有写java了,昨天学了下maven,不用手动的下载和添加jar包,实在是太方便. ------------------------------------------------------- ...
- PCL例程调试错误之缺少flann-config.cmake
编译环境和PCL版本为:win7-x64 + MSVC2013 + PCL1.8.0-win32-MSVC2013. 调试PCL官网例程Cluster Recognition and 6DOF Pos ...
- 《Unix环境高级编程》读书笔记 第13章-守护进程
1. 引言 守护进程是生存期长的一种进程.它们常常在系统引导装入时启动,仅在系统关闭时才终止.它们没有控制终端,在后台运行. 本章说明守护进程结构.如何编写守护进程程序.守护进程如何报告出错情况. 2 ...