Discussion:
Custom serialization question(s)
(too old to reply)
Joe Burke
2007-04-30 14:48:01 UTC
Permalink
I'm writing a custom XML serializer that can generate XML for any WinForm
object at design or run-time. But there are a couple of cases that I can't
handle properly, but the default Code DOM serializer does. I'd appreciate
any info on how to solve these cases:

1. How can I determine that an object needs to be created as a Resource?
For example, I can write property/value pairs or generate a byte array for an
image but the right answer is to use the bytes. Do I need to special case
just images? Is it because it supports ISerializable? Is it because it uses
an ImageConverter and can be converted to a byte[]? What's the best way to
differentiate this case?

2. I've found some Components just exist at design-time and I don't want
these serialized. For example, on a MenuStrip, at design time, there are
some extra items in the 'Items' collection. Namely something called
a'miniToolStrip' that shouldn't be saved. I haven't found the right logic to
filter out these design-time only components....any ideas?

Thanks,
Joe
jokiz
2007-05-12 02:33:33 UTC
Permalink
properties with DesignOnly attribute are serialized at the resource
file.
Post by Joe Burke
I'm writing a custom XML serializer that can generate XML for any WinForm
object at design or run-time. But there are a couple of cases that I can't
handle properly, but the default Code DOM serializer does. I'd appreciate
1. How can I determine that an object needs to be created as a Resource?
For example, I can write property/value pairs or generate a byte array for an
image but the right answer is to use the bytes. Do I need to special case
just images? Is it because it supports ISerializable? Is it because it uses
an ImageConverter and can be converted to a byte[]? What's the best way to
differentiate this case?
2. I've found some Components just exist at design-time and I don't want
these serialized. For example, on a MenuStrip, at design time, there are
some extra items in the 'Items' collection. Namely something called
a'miniToolStrip' that shouldn't be saved. I haven't found the right logic to
filter out these design-time only components....any ideas?
Thanks,
Joe
Loading...