【发布时间】:2016-08-29 05:31:05
【问题描述】:
在很多情况下,当我想将当前的 .NET Framework 项目转换为 .NET Core 等效项目时,某些类具有 Serializable 属性。
我应该怎么做才能在 .NET Core 中转换它们? (这次我删除它们!!!)
编辑
考虑这段代码:
using System;
namespace DotLiquid.Exceptions
{
[Serializable] // I delete it now !!!!!!!
public class FilterNotFoundException : Exception
{
public FilterNotFoundException(string message, FilterNotFoundException innerException)
: base(message, innerException)
{
}
public FilterNotFoundException(string message, params string[] args)
: base(string.Format(message, args))
{
}
public FilterNotFoundException(string message)
: base(message)
{
}
}
}
上面没有 [Serializable] 的代码在 .NET Core 中工作,没有语法问题。
但是我想知道什么时候删除[Serializable]
什么是副作用?
哪些地方应该改?
我什么时候应该使用 JSON.NET(或...)而不是 [Serializable]?
【问题讨论】: