Linq to Xml C# - How to get value of same level element with another elements property



I am not sure if I exactly worded the title correctly - it seems a bit complicated to sum up otherwise though. I will do my best to better explain here.


I have some XML that looks similar to this:



<Object type="element">
<Property name="name1" value="somevalue1"/>
<Property name="name2" value="somevalue2"/>
<Property name="name3" value="somevalue3"/>
</Object>


I would like to get the value of property name1 with using the value of propery name2. I have multiple objects that look similar too, but just thought that it would be better to just post one example of it to SO.


I already have the value of property name2 it is just a matter of being able to use it to get what i need. I would also like to do this using XML to LINQ.


I hope this makes sense. If there are any other questions feel free to comment and I will edit my post to clarify. Thanks!


No comments:

Post a Comment