如何排除序列特定类型的?

编程入门 行业动态 更新时间:2024-10-09 14:23:20
本文介绍了如何排除序列特定类型的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我跑 SGEN 对我组装一吨的类型。我要排除2种类型的序列化。我似乎并没有能够找到一种方法来做到这一点。

I run sgen against my assembly with a metric ton of types. I want to exclude 2 types from serialization. I don't seem to be able to find a way to do it.

我看到 SGEN 有一个 /类型开关来指定一个特定的类型,但没有排除特定的类型。

I see that sgen has a /type switch to specify a specific type, but nothing to exclude a specific type.

有没有办法从系列化排除特定类型的?

Is there a way to exclude specific types from serialization?

推荐答案

不知道如果你正在寻找这一点,但你可以通过提[非序列化]类定义之前排除你自己的类的序列化。 所以,如果你想排除特定的类型,你将不得不从它继承和创建自己的类

Not sure if you are looking for this but you can exclude your own classes from serialization by mentioning [NonSerialized] before class definition. So if you want to exclude a specific type you will have to inherit from it and create your own class

[NonSerialized] public class Point { public int x, y; }

更多推荐

如何排除序列特定类型的?

本文发布于:2023-11-25 17:57:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630754.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:序列   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!