• <tfoot id='zEWH9'></tfoot>

    1. <small id='zEWH9'></small><noframes id='zEWH9'>

        <bdo id='zEWH9'></bdo><ul id='zEWH9'></ul>

      1. <legend id='zEWH9'><style id='zEWH9'><dir id='zEWH9'><q id='zEWH9'></q></dir></style></legend>

        <i id='zEWH9'><tr id='zEWH9'><dt id='zEWH9'><q id='zEWH9'><span id='zEWH9'><b id='zEWH9'><form id='zEWH9'><ins id='zEWH9'></ins><ul id='zEWH9'></ul><sub id='zEWH9'></sub></form><legend id='zEWH9'></legend><bdo id='zEWH9'><pre id='zEWH9'><center id='zEWH9'></center></pre></bdo></b><th id='zEWH9'></th></span></q></dt></tr></i><div id='zEWH9'><tfoot id='zEWH9'></tfoot><dl id='zEWH9'><fieldset id='zEWH9'></fieldset></dl></div>

        为什么必须用属性 [serializable] 标记一个类?

        时间:2023-07-27
          <bdo id='MaTyS'></bdo><ul id='MaTyS'></ul>

              <tfoot id='MaTyS'></tfoot>
                <legend id='MaTyS'><style id='MaTyS'><dir id='MaTyS'><q id='MaTyS'></q></dir></style></legend>
                    <tbody id='MaTyS'></tbody>

                  <small id='MaTyS'></small><noframes id='MaTyS'>

                  <i id='MaTyS'><tr id='MaTyS'><dt id='MaTyS'><q id='MaTyS'><span id='MaTyS'><b id='MaTyS'><form id='MaTyS'><ins id='MaTyS'></ins><ul id='MaTyS'></ul><sub id='MaTyS'></sub></form><legend id='MaTyS'></legend><bdo id='MaTyS'><pre id='MaTyS'><center id='MaTyS'></center></pre></bdo></b><th id='MaTyS'></th></span></q></dt></tr></i><div id='MaTyS'><tfoot id='MaTyS'></tfoot><dl id='MaTyS'><fieldset id='MaTyS'></fieldset></dl></div>

                1. 本文介绍了为什么必须用属性 [serializable] 标记一个类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  您可以将任何文档转换为字节数组并将其保存到磁盘,然后将文件重建为其原始形式(只要您有文件名的元数据等).

                  Seeing as you can convert any document to a byte array and save it to disk, and then rebuild the file to its original form (as long as you have meta data for its filename etc.).

                  为什么你必须用 [Serializable] 等标记一个类?这与元数据"类型信息是否相同,因此当您将对象转换为其类时,事情会正确映射?

                  Why do you have to mark a class with [Serializable] etc? Is that just the same idea, "meta data" type information so when you cast the object to its class things are mapped properly?

                  推荐答案

                  首先,你没有.

                  它只是一个 标记接口,它告诉序列化程序该类由以下项组成它可以序列化(可能是也可能不是),也就是可以使用默认的序列化.

                  It is simply a marker interface that tells the serializer that the class is composed of items that it can serialize (which may or may not be true) and that is can use the default serialization.

                  XMLSerializer 有额外的要求,即类的构造函数为零参数.

                  The XMLSerializer has the additional requirement to have a zero parameter constructor to the class.

                  还有其他使用序列化合同的序列化程序(例如 DataContractSerializer) - 与简单地将类标记为 Serializable 相比,它们可以让您更好地控制序列化.您还可以通过实现 ISerializable 来获得更多控制权 接口.

                  There are other serializers that use contracts for serialization (such as the DataContractSerializer) - they give you more control over serialization than simply marking a class as Serializable. You can also get more control by implementing the ISerializable interface.

                  这篇关于为什么必须用属性 [serializable] 标记一个类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:任何人都知道快速获取枚举值的自定义属性的方法吗? 下一篇:如果多个成员具有相同的属性,如何引发编译器错误

                  相关文章

                  <small id='LWqWP'></small><noframes id='LWqWP'>

                2. <legend id='LWqWP'><style id='LWqWP'><dir id='LWqWP'><q id='LWqWP'></q></dir></style></legend>
                3. <tfoot id='LWqWP'></tfoot>
                4. <i id='LWqWP'><tr id='LWqWP'><dt id='LWqWP'><q id='LWqWP'><span id='LWqWP'><b id='LWqWP'><form id='LWqWP'><ins id='LWqWP'></ins><ul id='LWqWP'></ul><sub id='LWqWP'></sub></form><legend id='LWqWP'></legend><bdo id='LWqWP'><pre id='LWqWP'><center id='LWqWP'></center></pre></bdo></b><th id='LWqWP'></th></span></q></dt></tr></i><div id='LWqWP'><tfoot id='LWqWP'></tfoot><dl id='LWqWP'><fieldset id='LWqWP'></fieldset></dl></div>

                  • <bdo id='LWqWP'></bdo><ul id='LWqWP'></ul>