My purpose is to make a program that creates a new file destination that takes some values from another file. The XML file:
 <?xml version="1.0"?>
  <house>
  <chairs count="3">
  <chairs>a</chairs>
  <chairs>b</chairs>
  <chairs>c</chairs>
  </chairs>
 </house>
What I've done:
 static void Main(string[] args)
    {
       using (XmlReader reader = XmlReader.Create("file.xml"))
        {
            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                        case "chairs":
                            if (reader.Read())
                            {
                                string l;
                                l = reader.Value.Trim();
                                //(*)
                            }
                            break;
                    }
                }
            }
        }
  // (**)f = l + " ";
If I write at the * line :
 Console.WriteLine(l), it will print me:
 a
 b
 c 
But if I delete the (*) and I uncomment the (**), in the new created file it only shows c because I think it overrides the a and b because of concatenation. It is possible to take all the values a,b,c and to write in the file, not only the last value?
 
     
    