• C#对象序列化笔记


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.Serialization;
    using System.Runtime.Serialization.Json;
    using System.IO;
    
    namespace BIMTClassLibrary
    {
        /// <summary>
        /// 获取用户使用推荐审稿人的信息
        /// wuhailong
        /// 2016-08-19
        /// </summary>
        public class ReviewerPostEntity
        {
            [DataMember(Name = "userId", IsRequired = false, Order = 0)]
            public string userId = string.Empty;
            [DataMember(Name = "kwTitle", IsRequired = false, Order = 0)]
            public string kwTitle = string.Empty;
            [DataMember(Name = "kwAbstr", IsRequired = false, Order = 0)]
            public string kwAbstr = string.Empty;
            [DataMember(Name = "kwKeyword", IsRequired = false, Order = 0)]
            public string kwKeyword = string.Empty;
            [DataMember(Name = "readers", IsRequired = false, Order = 0)]
            public List<ReviewerInfo> readers = null;
            [DataMember(Name = "createTime", IsRequired = false, Order = 0)]
            public string createTime = string.Empty;
    
            public ReviewerPostEntity(string userId, string kwTitle, string kwAbstr, string kwKeyword, List<ReviewerInfo> readers, string createTime)
            {
                try
                {
                    this.userId = userId;
                    this.kwTitle = kwTitle;
                    this.kwAbstr = kwAbstr;
                    this.kwKeyword = kwKeyword;
                    this.readers = readers;
                    this.createTime = createTime;
                }
                catch (Exception)
                {
                    throw;
                }
            }
    
            public ReviewerPostEntity( ) { }
    
            public override string ToString()
            {
                DataContractJsonSerializer dataContractSerializer = new DataContractJsonSerializer(this.GetType());
                using (MemoryStream ms = new MemoryStream())
                {
                    dataContractSerializer.WriteObject(ms, this);
                    return Encoding.UTF8.GetString(ms.ToArray());
                }
            }
        }
    }
    

      

  • 相关阅读:
    第01组 Beta冲刺(1/5)
    2019 SDN上机第6次作业
    2019 SDN上机第5次作业
    SDN课程阅读作业(2)
    USDT钱包对接交易所 寻找最便捷的USDT充提币API接口文档
    EOS区块链钱包开发教程
    XRP钱包对接教程
    usdt钱包如何跟交易所对接?
    BTC_ETH_USDT_自动充提币API接口,钱包对接交易所教程!
    BTC bitcoin-cli转账及交易的API使用教程
  • 原文地址:https://www.cnblogs.com/wuhailong/p/5787495.html
Copyright © 2020-2023  润新知