Adding XmlElement to XmlElement[ ] dynamically RRS feed

  • Question

  • User136609187 posted

    I want to add XmlElement to XmlElement[ ] array dynamically.

    Am trying like this below.But in case of multiple Elements not sure how to add..

    Need to create multiple XmlElement based on criteria and add to this Array

    Please help me out

       var xmlDoc = new XmlDocument();
                var xelement = xmlDoc.CreateElement("DocId");
                xelement.InnerText = "Test";
                var xelemArray = new XmlElement[]

    Tuesday, September 30, 2014 12:05 PM


  • User1918509225 posted

    Hi Chithra_lyer,

    I  suggest that you can define  List<XmlElement> instead  of  Array:

    List<XmlElement> list=new List<XmlElement>();
    for(int i=0;i<10:i++){
      XmlElement xm=new XmlElement();

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 1, 2014 3:56 AM