这是什么[System.SerializableAttribute()]做 [英] What does [System.SerializableAttribute()] do

查看:275
本文介绍了这是什么[System.SerializableAttribute()]做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待在偷别人的C#代码和公共枚举之前有下面几行:

I am looking at somebody elses C# code and before a public enum there are the following lines:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]

有人可以解释用简单的英语是什么每条线路都在做。

Can somebody explain in plain english what each of these lines are doing.

推荐答案

该System.SerializableAttribute指定的运行时的类的实例可序列化

The System.SerializableAttribute specifies to the runtime that the instances of that class can be serialized

例如。你在一个WCF服务调用返回的对象。如果对象有此属性和所有它里面的对象都是可序列化,运行时将改变该对象JSON或XML,这取决于资源的Web服务返回的类型。

Eg. You return an object in a WCF service call. If that object has this attribute and all of the objects inside it are serializable, the runtime will transform that object to JSON or XML, depending on the type of resource the web service returns.

这篇关于这是什么[System.SerializableAttribute()]做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆