惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

博客园 - DataFlow

word break 在不同浏览器中的表现 系统架构 创造HTTPS的是个神 为Chrome开发插件提高工作效率 Javascript 控制style 小结 svcutil 生成代理类时的问题 xeam Build Definition Extension uninstall 卸载 Wcf客户端配置里Endpoint的Name属性无效 屏蔽电信流氓弹出广告 正则替换中的一个Bug SQL server 性能相关 SQL Express 相关 时间格式 输出一个在没有.Net 环境的机器也可以跑得安装包 再谈性能力 SCOM Configuration NumSamples and Absolute XML中的时间 decimal.Round 的区别 Dos中常用的命令
反序列化怪现象,数组无父
DataFlow · 2012-03-08 · via 博客园 - DataFlow

碰到Java序列化出来奇怪xml如:

<User>

      <Friend>张三</Friend>

      <Friend>张三</Friend>

      <Friend>张三</Friend>

</User>

奇怪的是,Friend是一个数组,但并没有父元素,这种情况 如果反序列化?

[Serializable]
public class User
{
    public Friend[] Friend { get; set; }
}

是不行的。

正确方法:

[Serializable]
public class User
    {
        [XmlElement]
        public Friend[] Friend{ get; set; }
    }

还好是用XMLSerializer, 如果使用DataContractSerializer, 应该是不行的。