c# - What is the equivalent of [Serializable] in .NET Core ? (Conversion Projects) -
in many cases, when want convert current .net framework projects .net core equivalent, classes have serializable attribute.
what should convert them in .net core ? (in time delete them !!!)
edit
consider code :
using system; namespace dotliquid.exceptions { [serializable] // delete !!!!!!! 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) { } } }
above code without [serializable] works in .net core without syntax problem.
but want know when delete [serializable]
what side effects ?
what places should changed?
when should use json.net (or ...) instead of [serializable] ?
if aren't serializing type (that is, using binaryformatter
), can remove [serializable]
, forget it.
if using binaryformatter serialize before, need come own plan on how work (ie. via json.net or xml).
if porting library , asking on behalf of consumers answer same: remove [serializable]
, leave serialization need it.
Comments
Post a Comment