Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to comment this line using C# code.
<body>Don't forget me this weekend!</body>
Posted
Comments
Dominic Abraham 11-Feb-15 7:22am    
Can you please little more clear about your issue. Are you want edit some xml file using the C# application ?
Member 11444399 11-Feb-15 7:44am    
No i want to comment <heading>Reminder</heading> this line by C# code.

<note>
<to>Tove
<from>Jani
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
Member 11444399 11-Feb-15 7:48am    
I am creating on windows application .which has one button(comment) .By clicking comment button particular xml tage should be commented.

1 solution

If you used the XDocument class to manage your XML, you could get the selected XElement and replace it with a XComment.

https://msdn.microsoft.com/en-us/library/system.xml.linq.xcontainer.nodes%28v=vs.110%29.aspx[^]
 
Share this answer
 

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