Serializing System.Drawing.Color in .NET
Posted
by alankdkd
on Stack Overflow
See other posts from Stack Overflow
or by alankdkd
Published on 2010-03-19T21:34:11Z
Indexed on
2010/03/19
21:51 UTC
Read the original article
Hit count: 209
.NET
|serialization
Hi all,
I've used the default .NET serialization for a class with a System.Drawing.Color member. The code is now in use by people, and I need to add an extra member to the class, but still deserialize older versions.
So I tried the standard way of doing this: The ISerializable interface, using SerializationInfo methods to get the int and string members.
The problem: My class also has a System.Drawing.Color member, but SerializationInfo doesn't provide a "GetColor" method read this data type. I've tried getting it as an int and as a string, and casting it to System.Drawing.Color, but no luck.
Does anyone know how to deserialize a System.Drawing.Color from SerializationInfo?
Thanx! Alan
© Stack Overflow or respective owner