Home > Backend Development > C#.Net Tutorial > Detailed explanation of serialization and deserialization examples related to contract classes

Detailed explanation of serialization and deserialization examples related to contract classes

零下一度
Release: 2017-06-23 16:23:56
Original
1518 people have browsed it

The contract class refers to the class that inherits: DataContract. Contract classes are often used to transmit data in various services such as WCF and webService.

For any contract class or a class that inherits a contract class, if you want attributes to participate in serialization and deserialization, you need to add a mark to the attribute: DataMember  

Such as:

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.Serialization;namespace SinoOcean.Seagull2.Framework.Contracts.Fund
{
    [DataContract]public class SubAccountItemContract
    {#region 属性/// <summary>/// 账号/// </summary>        [DataMember]public string AccountNumber { get; set; }/// <summary>/// 金额/// </summary>        [DataMember]public decimal Money { get; set; }
   }
}
Copy after login

The above is the detailed content of Detailed explanation of serialization and deserialization examples related to contract classes. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template