simple linq question!

  • Thread starter Thread starter CSharper
  • Start date Start date
C

CSharper

This may be a dump question, so please bear with me. I have an xml
file like the following

<teacher>
<name>jkjk</name>
<phone>122</phone>
</teacher>
<student>
....
</student>
<student>
....
</student>

etc.,

In this I have one node with teacher and all the other nodes are
students. I want to use linq to get only the teacher node. Is it
possible to do it?

Thanks.
 
This may be a dump question, so please bear with me. I have an xml
file like the following

<teacher>
<name>jkjk</name>
<phone>122</phone>
</teacher>
<student>
 ....
</student>
<student>
 ....
</student>

etc.,

In this I have one node with teacher and all the other nodes are
students. I want to use linq to get only the teacher node. Is it
possible to do it?

Thanks.

I found it, myDocument.Decendants("teacher") will help me resolve the
problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top