Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
[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.
Posted

1 solution

Mark this Field or Property with XmlIgnoreAttribute.
 
Share this answer
 
Comments
gkmaheshwari 10-Apr-13 1:59am    
but in that i must need to modify my orignal class, as in subject , i already describe that withour midify orignal class how i can acheive this.
stibee 10-Apr-13 9:49am    
Sorry I didn't read it right, but I think you chance to do this if you use automatic xml-serializing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900