Created
January 23, 2015 17:44
-
-
Save anonymous/e2d78b44e1d0cbf1fa0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Linq; | |
| using System.Xml.Linq; | |
| namespace ExampleConsoleApp | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| const string xml = "<weather><temperature>30C</temperature><foo>bar</foo></weather>"; | |
| var xdoc = XDocument.Parse(xml); | |
| var temperature = xdoc.Descendants().Single(d => d.Name == "temperature").Value; | |
| Console.WriteLine(temperature); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment