I have an XML file with the following structure:
<Definitions>
<Definition Execution="Firstkey" Name="Somevalue"></Definition>
<Definition Execution="Secondkey" Name="Someothervalue"></Definition>
</Definitions>
How can I get the values of the keys (Firstkey, Secondkey) and write them down using C# in my .NET application?
Thanks.
Using Linq to XML this is straightforward.
To just get the keys:
To get all values:
Edit in response to comment:
I think what you really want is a dictionary, that maps from a key (“Execution”) to a value (“Name”):