https://www.newtonsoft.com/json/help/html/DataContractAndDataMember.htm

如果class使用了DataContract,name没有使用DataMember的property就不解析

[DataContract]
public class File
{
// excluded from serialization
// does not have DataMemberAttribute
public Guid Id { get; set; } [DataMember]
public string Name { get; set; } [DataMember]
public int Size { get; set; }
} File file = new File
{
Id = Guid.NewGuid(),
Name = "ImportantLegalDocuments.docx",
Size = *
}; string json = JsonConvert.SerializeObject(file, Formatting.Indented); Console.WriteLine(json);
// {
// "Name": "ImportantLegalDocuments.docx",
// "Size": 51200
// }

最新文章

  1. MFC下打开选择文件夹并获取文件夹的绝对路径
  2. puppet安装
  3. Python面试里面的那些问题
  4. UI3_CustomUITableViewCell
  5. 使用JavaScript检测浏览器
  6. HTTP协议(三)
  7. hive -- 协同过滤sql语句
  8. database锁实现
  9. MFC为多个控件绑定同一个函数
  10. Python模拟微博登陆,亲测有效
  11. spring邮件发送
  12. centos7搭建mysql5.7主从同步
  13. Python 优雅获取本机 IP 方法
  14. js文件流下载通用方法
  15. 转载:mysql binlog同步redis
  16. mysql允许远程登录
  17. Git 同步远程仓库
  18. Android 通过触摸动态地在屏幕上画矩形
  19. homebrew命令
  20. 安装VS2010 SP1后,再安装mvc3

热门文章

  1. Linux命令学习之xargs命令
  2. Python 导入与注册
  3. C# DateTime.Now详细用法
  4. postgresql----唯一索引,表达式索引,部分索引
  5. 【node】----mocha单元测试框架-----【巷子】
  6. VMware Authorization Service 未运行怎么解决
  7. Java spring mvc多数据源配置
  8. ubuntu 安装搜狗
  9. python网络编程知识体系
  10. H5保养