The blog has moved to a new address. The blog is now located at

Friday, August 11, 2006

How do I get the class to serialize correctly?

While most common types can be serialized in one of two ways listed above, there are some types that may not. In such cases, you have a few different options:

  • Implement a TypeConverter for the type that can convert to and from string. The implementation can use a suitable serialization mechanism like one of the formatters/serializers that ship in the Framework or any custom mechanism you wish. You can then specify this converter on the type itself or on the property in your settings class.

  • Specify a particular SettingsSerializeAs enum value using a SettingsSerializeAsAttribute. For example, if you wish to serialize a setting in binary format, simply specify SettingsSerializeAs.Binary.

Technorati : , ,

No comments: