Recursive search Linq to xml
- by Raj Esh
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.