Using linq xml in c# how would I extract in for a given predecessor of SetSeg with a certain value in
Eg seatseg num =10 the following Seatassignment loc=??
<top>
<SeatSeg>
<Num>9</Num>
</SeatSeg>
<SeatAssignment>
<Loc>032A</Loc>
</SeatAssignment>
<SeatSeg>
<Num>10</Num>
</SeatSeg>
<SeatAssignment>
<Loc>033A</Loc>
</SeatAssignment>
</top>
I ran this and it writes out 032A.
However, looking at the xml, it seems like the following which prints out 033A is what you want
ElementsBeforeSelf() will pull all the preceding siblings. Last() will get the last of the sequence.
Conversely, ElementsAfterSelf() will pull all the subsequent siblings. First() will get the first of the sequence.