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
Order
property first and then alphabetically if there is more than one member of a certainOrder
value. 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, ...
随机推荐
- HDU 4321 Contest 3
题意:给定a和b,n,让你求b+a, b+2*a, .......b+n*a里面有多少1. 当统计第K位的时候 可以注意到 第 B+T*A 和 B+(T+2^(K+1))*A 位是相同的 那么 第K位 ...
- 树莓派学习笔记—— 源码方式安装opencv
0.前言 本文介绍怎样在树莓派中通过编译源码的方式安装opencv,并通过一个简单的样例说明怎样使用opencv. 很多其它内容请參考--[树莓派学习笔记--索引博文] 1.下载若干依 ...
- POJ 1496 POJ 1850 组合计数
Code Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8256 Accepted: 3906 Description Tran ...
- CSS文本简单设置
文本的设置直接影响到用户对界面的感受,好的文本设置能够让用户对界面有一种赏心悦目的感受,在这地方我们来简单的说说说对文本设置的时候,有哪些格式. 文本设置的时候我们应该注意什么: 平时我们文本设置的时 ...
- bzoj4554: [Tjoi2016&Heoi2016]游戏(二分图匹配)
4554: [Tjoi2016&Heoi2016]游戏 题目:传送门 题解: 一道很牛逼的匈牙利..和之前模拟赛的一道题有点相似(不过这题不用完美匹配) 我们可以把连续的行和列全部编号(如果之 ...
- [jzoj 5177] [NOIP2017提高组模拟6.28] TRAVEL 解题报告 (二分)
题目链接: https://jzoj.net/senior/#main/show/5177 题目: 题解: 首先选出的泡泡怪一定是连续的一段 L,R 然后 L 一定属于虫洞左边界中的某一个 R 也同样 ...
- POJ 3268 Dijkstra+priority_queue或SPFA
思路:正向建边,一遍Dijkstra,反向建边,再一遍Dijkstra.ans加在一起输出最大值. (SPFA也行--) // by SiriusRen #include <queue> ...
- Codeforces 667D World Tour 最短路
链接 Codeforces 667D World Tour 题意 给你一个有向稀疏图,3000个点,5000条边. 问选出4个点A,B,C,D 使得 A-B, B-C, C-D 的最短路之和最大. 思 ...
- PSSecurityException之PowerShell权限设置
Windows下PowerShell默认的权限级别是Restricted,不允许执行PS脚本(即.ps1文件).如果在Restricted权限级别下运行,会得到错误信息: .\XXXX.ps1 : F ...
- Android 设计一个菱形形状的Imageview组件.
网上没有资料,特来请教下大神 Android 设计一个菱形形状的Imageview组件. >> android这个答案描述的挺清楚的:http://www.goodpm.net/postr ...