K
Keshav
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 <Mode><Automatic/></Mode> or
<Mode><Manual/></Mode>
The Operation object should get serialized as
<Operation Id="Operation1" Name="ship">
<Description>Ship from stock or production</Description>
<Mode>
<Automatic/>
</Mode>
</Operation>
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
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 <Mode><Automatic/></Mode> or
<Mode><Manual/></Mode>
The Operation object should get serialized as
<Operation Id="Operation1" Name="ship">
<Description>Ship from stock or production</Description>
<Mode>
<Automatic/>
</Mode>
</Operation>
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