469,358 Members | 1,610 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Deserializing an object from XML that contains an enum

I'm having an issue in deserializing an object from XML. I generated my XML
schema from my .NET dll using xsd.exe. I've used that schema in another
application. That application spits out XML based on user input and workflow.
It is sending out the integer value for enums instead of the string values.
This seems like it should be the most common sense way to do it (since it's
an easy cast from int to an enum (MyEnum)myInt) but XML deserialization
complains. If I manually edit the XML to contain the strings for those, it
successfully casts the strings into the enum.

Is there a work around other than implementing ISerializable and controlling
the serialization/deserialization of the object manually? I could also alter
the external application, but I'm hoping not to have to waste the effort of
modifying multiple instances if there is an attribute that I can put on the
property that will make it work (or some other fix).
Jun 14 '07 #1
0 2240

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark McConnell | last post: by
5 posts views Thread by Lucas | last post: by
1 post views Thread by john wright | last post: by
1 post views Thread by =?Utf-8?B?SmVyZW15X0I=?= | last post: by
10 posts views Thread by yu_kuo | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.