Walter,
In C#, you can not use a number as the first character in an identifier.
You will have to do something like this:
public enum typeSupply
{
[XmlEnum(Name = "5VOnly")]
FiveVOnly,
[XmlEnum(Name = "3V")]
ThreeV
}
The Xml serialization engine will still be able to pick out values in
the XML file named "5VOnly" and "3V".
I am curious, are you applying the Serializable attribute because you
use this enumeration in Serialization with a Binary or Soap formatter as
well, or for XML serialization? If the answer is the latter, then you do
not need to put the Serializable attribute on the enumeration, because XML
serialization does not use this attribute.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"wasco77" <wa*****@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
Hi all,
I've a problem using enum tag.
I need to create a structure like this:
// ---------------------------------------
[Serializable]
public enum typeSupply
{
[XmlEnum(Name = "5VOnly")]
5VOnly,
[XmlEnum(Name = "3V")]
3V
}
// ---------------------------------------
but I can't define an enum item starting with a number.
Do you know how define an item name starting with number?
I use it in order to serialize/deserialize an xml file, which include
a tag with that item.
Thanks in advance.
Walter