Getting a set of elements using linq

Posted by MarceloRamires on Stack Overflow See other posts from Stack Overflow or by MarceloRamires
Published on 2010-03-26T21:01:37Z Indexed on 2010/03/26 21:03 UTC
Read the original article Hit count: 351

Filed under:
|
|
|
|

I have the following piece of XML:

<xml>
   <ObsCont xCampo="field1">
      <xTexto>example1</xTexto>
   </ObsCont>
   <ObsCont xCampo="field2">
      <xTexto>example2</xTexto>
   </ObsCont>
   <ObsCont xCampo="field3">
      <xTexto>example3</xTexto>
   </ObsCont>
</xml>

How do I (using linq) get for example what is inside the xTexto tag that has as parent the ObsCont with the xCampo attribute "field2" ?

(c#, vb.net, your choice)

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about Xml