Control::Flow - ISerializationSurrogate. DependencyProperty Serialization Part II: ISerializationSurrogate, Reflection Magic and a strange Exception | emphess .NET. First off, my apologies for not posting the second part earlier.
I have had a lot to do in the past Months… Part II of the article will show how a SerializationSurrogate works and explore wheter we can use it for generic de-serialization of DependencyProperties.
C# Tutorial - Serialize Objects to a File. While storing information in memory is great, there comes a time your users will have to shut your application down.
This means (probably) that you will need to write information to a file at some point, because you will want to store whatever data was in memory. Today, we are going to take a look at a feature built into .NET called Serialization that makes writing and reading data structures to and from a file extremely easy. For this example, let's say I want to create a program that keeps track of all the cars my friends own.
I'm going to create two objects to achieve this: Car and Owner. C# Tutorial - XML Serialization. A long while ago we posted a tutorial on how to serialize objects to a binary file.
While this is very useful, unfortunately the resulting file is not very human readable. In this tutorial, I'm going to demonstrate how to serialize your own objects to and from an XML file. Since .NET can use reflection to get property names, basic serialization is unbelievably simple. It only gets slightly difficult when you want to name your XML tags differently than your property names (but still not very hard). If you've ever used an XML serialization package in C++ like boost, tinyXML, or libXML2, you'll see how comparatively easy C# is to use.