1

this is the xml

<Basic>
  <Results>
    <Result>a1</Result>
    <Result>a2</Result>
    <Result>a3</Result>
  </Results>
</Basic>

I need to read this xml file and create a list that will contain

list[0] = a1   
list[1] = a2   
list[2] = a3   

what is the simple and fast way to do it ?

1

2 Answers 2

4

You can use LinqToXml

var list = XDocument.Load(filename)
           .Descendants("Result")
           .Select(x => (string)x)
           .ToList();
Sign up to request clarification or add additional context in comments.

Comments

1

With an XML reader and a codec to convert the DOM tree to a list.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.