Why is my XML reader reading every other element?

后端 未结 1 1708
悲&欢浪女
悲&欢浪女 2021-01-20 16:53

I\'ve built a very simple table that displays 4 columns and 4 rows. When the following code is executed it displays every other element in the .xml file. It does not discri

相关标签:
1条回答
  • 2021-01-20 17:47

    Because both .Read() and .ReadElementContentAsString() (the parameterless overload) move the reader to the next node.

    Change your while condition to:

    while (!reader.EOF)
    

    Then add:

    else reader.Read();
    
    0 讨论(0)
提交回复
热议问题