How to use XCData in naming xelements in c#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Csharpcoder
    New Member
    • Aug 2018
    • 1

    How to use XCData in naming xelements in c#?

    I want to use texbox text to name my elements i have tried using XCData but it returns with names cannot begin with '<'. Here is my code.


    Code:
      XDocument xdoc = XDocument.Load("SavedData.xml");
                xdoc.Add(new XElement(new XCData(textbox1.text).ToString(),textbox2.text));
    Last edited by zmbd; Aug 15 '18, 09:09 PM. Reason: [z{when posting script/code please use the [CODE/] formatting tool. :) }]
Working...