|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Deserialize enum value as integerDoes anyone know of a way to deserialize xml data that has an element that represents an enum value but is actually an integer? I know I can use [XmlEnum(Name="23")] to tag enum values, that works but is too messy. I have many enums and would prefer not to have to tag them all! xml data <myclass> <MyProperty>23</MyProperty> </myclass> VB code snippet: Public enum MyEnum value1 = 23 value2 =888 End enum public class myclass public MyProperty as MyEnum .... end class This is exactly the same problem as I found somebody else had had before (but didn't seem to get an answer). http://groups.google.com.au/group/microsoft.public.dotnet.languages.csharp/browse_frm/thread/438bcd60e8813b9c/d6ba3858f50b944a?lnk=st&q=xml+deserialize+enum+as+int&rnum=1&hl=en#d6ba3858f50b944a thanks in advance Richard ----------- Please provide code examples in VB if possible...thanks! ----------- Hi Richard,
As far as I know, the only way to tag values for enum type, is to use XmlEnum attribute. There is no better ways than this. Sorry for the inconvenience. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Did we lose the RadioCheck property on menuitems
How does the community rate .NET 2005 vs. .NET 2003? List.Add method overwriting collectionbase? Webapplications quits without matter in ASP.NET 2.0 Ado.net to excel ? Listbox controls The variable 'GroupBox1' is either undeclared or was never assigned. List all public properties of a Class ? How to move a menu item to the left?! i love reflection:) |
|||||||||||||||||||||||