Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

Serialization Support in the Framework

The .NET Framework includes extensive support for both serialization and deserialization, both from the perspective of clients wanting to serialize and deserialize objects, and from the perspective of types wanting some control over how and where they are serialized. This support is found in two sets of namespaces: System.Runtime.Serialization.* and System.Xml.Serialization.*

Each of these namespaces includes a suite of types that, together with your types, form a serialization “engine,” which has the ability to serialize one or more objects into a stream of some kind. Additionally, each of these namespaces supports XML as a serialization format (the System.Runtime.Serialization.* namespaces also support a binary serialization format).

The primary differences between the two serialization engines are that the one contained in the System.Runtime.Serialization.* namespaces supports arbitrary object graphs and can serialize any .NET type using SOAP section 5 encoding. However, this engine produces XML that is very CLR-centric, describing primitive types using XML namespaces and schemas that assume the reader understands the CLR type system. On the other hand, the serialization engine contained in the System.Xml.Serialization.* namespaces produces very clean XSD schemas and matching XML instances, describing primitive types in terms of XSD data types wherever possible. However, it cannot handle arbitrary object graphs, and in some cases doesn’t ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata