可序列化对象与不可序列化对象 [英] Serializable objects vs. non-serializable objects

查看:87
本文介绍了可序列化对象与不可序列化对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C# 中可序列化对象和不可序列化对象有什么区别,是什么使对象可序列化?

What is the difference between serializable objects and non-serializable objects in C#, and what makes an object serializable?

可序列化对象与 XML 有什么关系?

What do serializable objects have to do with XML?

推荐答案

可序列化对象与不可序列化对象的区别是什么

what is the differnce Serializable objects vs non serialivable objects

可序列化对象可以转换为其他一些表示形式,例如文本,以便轻松跨进程边界传输,而不可序列化对象则不能.

A serializable object can be converted into some other representation such as text in order to be easily transmitted across process boundaries while a non-serializable object cannot.

什么使对象可序列化

在 .NET 中,根据您决定使用的序列化程序,对象需要符合某些要求.例如,如果您使用 BinaryFormatter 您的对象需要使用 [Serializable] 属性.

In .NET depending on the serializer you decide to use, the object needs to correspond to certain requirements. For example if you use the BinaryFormatter your object needs to be decorated with the [Serializable] attribute.

可序列化对象与 xml 有什么关系

And What does serializable objects have to do with xml

一个对象可以被序列化为 XML.例如,在 .NET 中,这可以通过 XmlSerializer 类,而且还有 DataContractSerializer.

An object could be serialized into XML. In .NET this could be achieved for example with the XmlSerializer class but also with the DataContractSerializer.

这篇关于可序列化对象与不可序列化对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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