Windows 10 UWP应用中没有System.Serializable属性? [英] System.Serializable attribute gone in Windows 10 UWP apps?

查看:32
本文介绍了Windows 10 UWP应用中没有System.Serializable属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试将开放源代码库(Aforge.net)移植到UWP时,我发现System.Serializable属性似乎不存在.UWP的参考工作方式有所不同,我仍在努力应对这些变化,所以我希望我只是缺少一些简单的东西.

While trying to port an open source library (Aforge.net) to UWP, I discovered the System.Serializable attribute does not seem to exist. References for UWP work a little differently and I'm still trying to wrap my head around the changes so I hope I'm just missing something simple.

我的问题是,请问有人可以确认System.Serializable属性在UWP应用中是否可以工作?我尝试通过MSDN和其他各种Google来源进行搜索,但无法找到任何一种或另一种证据.

My question is, can someone please confirm whether the System.Serializable attribute works/should work in a UWP app? I've tried looking through MSDN and various other google sources but cannot find any evidence one way or another.

非常感谢您的帮助.

更新
看来我可能需要使用DataContract/DataMember属性而不是像可移植库中提到的Serializable属性:有想法吗?

推荐答案

您需要使用以下属性:

[DataContract]

并使用

[DataMember]

[IgnoreDataMember]

例如:

[DataContract]
public class Foo
{
    [DataMember]
    public string Bar { get; set; }

    [IgnoreDataMember]
    public string FizzBuzz { get; set; }
}

这篇关于Windows 10 UWP应用中没有System.Serializable属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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