xml - What is the preferred way to implement serializable classes in C# -


i've seen many different ways serialize objects in c# i'm not sure 1 use , when.

in current situation i'm serializing exposure through wcf i'm guessing [datacontract] attribute way go.

currently i'm reading in xml, exposing resulting object through wcf. deserializing xml have no access original classes (therefore i'm rebuilding class , can implement serialization whichever way want). has serializable wcf.

but if [datacontract] case, why wouldn't use time instead of iserializable, or [serializable] attribute?

so bit of 2 questions in one, use problem, , why there different ways serialize.

datacontract place start basic serializing. if want control how object serialized use iserializable interface. also, data contract attribute not inherited, iserializable will

iserializable has been around since .net 1.1. datacontract introduced in .net 3.0 simplify serializing cases.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -