kmurthy2

kmurthy2

  • NA
  • 3
  • 0

XmlSerialization - mapping enum variable to xmlelement

Feb 6 2004 9:33 AM
Hi While i'm doing XML serialization in C# class.... I have the following problem... I have an class by name "Operation" In that i have two variables Id and Name and one more enum variable Mode... Mode has got values { Manual , Automatic } I am able to make Id and Name variable as XML Attribute... I want the mode should be represented as either or The Operation object should get serialized as Ship from stock or production My code looks like public enum ModeEnum {Manual,Automatic} public class WFActivity : WFProperty { private string _id; private string _name; private string _description; private ModeEnum modeenum; [XmlAttribute("Id")] /* sets or gets id */ public string Id { get { return _id; } set { _id = value; } } [XmlAttribute("Name")] /* sets or gets name */ public string Name { get { return _name; } set { _name = value; } } [XmlElement("Description")] /* sets or gets description */ public string Description { get { return _description; } set { _description = value; } } } Pls throw some light on this. Thanks in Advance Keshav

Answers (1)