Answer to Question #28119 in C# for kumar
Subject: C# - serialize only those properties whcich are specified [xmlattribute(“NAME”)] without changing the original class
[Serializable]
public class MyClass
{
[XmlElement("Company")]
public string Company { get; set; }
[XmlElement("Amount")]
public decimal Amount { get; set; }
public int companyid { get; set; }
}
now i want to serilize only thoese which are specified with [XmlElement], companyid not to be serilized.
so what i can do.
1
2013-04-10T11:42:02-0400
[NonSerialized()]
[Serializable]
public class MyClass
{
[XmlElement("Company")]
public string Company { get; set; }
[XmlElement("Amount")]
public decimal Amount { get; set; }
[NonSerialized()]
public int companyid { get; set; }
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C#
Comments
Leave a comment