This project has moved and is read-only. For the latest updates, please go here.

Objects with TypeConverters assigned

Apr 15, 2008 at 4:51 AM
I have an object that I'm trying to serialize that is used as a complex property on a server control I am building. To support the .NET design time interface, this object has a TypeConverter assigned:

public class ContainerLayout

The issue is that this really blows up the serialization and just gives me back the string of the type. ("My.Namespace.Object")

Is there any way around this, so that I can get the serialization to use the proper type converters for JSON? Or should I just create a little data object that I use for the serialization and serialize that instead so it doesn't conflict with the server control object?

Apr 18, 2008 at 2:28 PM
for the record, I just used a "data" object that I saved all of my property values too and serialized that. Was the fastest, easiest solution.
Apr 26, 2008 at 1:52 AM
I haven't tested this but try creating a class that inherits from ExpandableObjectConverter and override the CanConvertTo(ITypeDescriptorContext context, Type destinationType) method so that it returns false. Use the new class instead of ExpandableObjectConverter.