Windows 8 从.Net到winRT的转换
我有以下代码;我想把它转换成winRT。实际上,我不知道如何处理ISerializable、Serializable、SerializationInfo和COMPACT_框架Windows 8 从.Net到winRT的转换,windows-8,windows-phone-8,windows-runtime,c#-5.0,Windows 8,Windows Phone 8,Windows Runtime,C# 5.0,我有以下代码;我想把它转换成winRT。实际上,我不知道如何处理ISerializable、Serializable、SerializationInfo和COMPACT_框架 using System; using System.Collections; #if !COMPACT_FRAMEWORK using System.Runtime.Serialization; #endif namespace Coversant.Attributes { [Serializable] pub
using System;
using System.Collections;
#if !COMPACT_FRAMEWORK
using System.Runtime.Serialization;
#endif
namespace Coversant.Attributes
{
[Serializable]
public class AssertionFailedError : Exception
#if !COMPACT_FRAMEWORK, ISerializable
#endif
{
#if !COMPACT_FRAMEWORK
protected AssertionFailedError(SerializationInfo info, StreamingContext context) : base(info, context){}
#endif
}
}我相信COMPACT#u框架是一些旧的小型设备上的框架,预处理器指令(
#if
,#endif
)只是界定了在构建COMPACT框架以外的任何东西时编译代码时应该使用的代码。WinRT实际上类似于缺少这些属性,但也缺少Serializable
属性,因此您可以这样做,这本质上是一个简单的异常类定义,不包括任何新的或重写的成员:
using System;
using System.Collections;
#if (!COMPACT_FRAMEWORK && !NETFX_CORE)
using System.Runtime.Serialization;
#endif
namespace Coversant.Attributes
{
#if !NETFX_CORE
[Serializable]
#endif
public class AssertionFailedError : Exception
#if (!COMPACT_FRAMEWORK && !NETFX_CORE)
, ISerializable
#endif
{
#if (!COMPACT_FRAMEWORK && !NETFX_CORE)
protected AssertionFailedError(SerializationInfo info, StreamingContext context) : base(info, context){}
#endif
}
}