Recursive search Linq to xml

Posted by Raj Esh on Stack Overflow See other posts from Stack Overflow or by Raj Esh
Published on 2012-09-06T21:06:25Z Indexed on 2012/09/06 21:38 UTC
Read the original article Hit count: 203

Filed under:
|
|

this is my sample xml.

<Messages>
  <Conversation>
    <id>Z100</id>
    <ReplyToId></ReplyToId>
    <Message>Topic</Message>
  </Conversation>
  <Conversation>
    <id>A100</id>
    <ReplyToId></ReplyToId>
    <Message>This is a test</Message>
  </Conversation>
  <Conversation>
    <id>M100</id>
    <ReplyToId>A100</ReplyToId>
    <Message>What kind of test</Message>
  </Conversation>
  <Conversation>
    <id>A200</id>
    <ReplyToId>M100</ReplyToId>
    <Message>Stage 1</Message>
  </Conversation>
  <Conversation>
    <id>M200</id>
    <ReplyToId>A200</ReplyToId>
    <Message>Test result for </Message>
  </Conversation>
</Messages>

How to get the conversation list based on id using linq in C#. Say for example, If i want to get the conversation for id "A100" which has a link to other conversation based on ReplyToid.

© Stack Overflow or respective owner

Related posts about c#-4.0

Related posts about twitter-api