Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created January 24, 2024 11:51
Show Gist options
  • Save jskeet/37a0b979b59da8ece16867eb1f338a04 to your computer and use it in GitHub Desktop.
Save jskeet/37a0b979b59da8ece16867eb1f338a04 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using System.Xml.Linq;
var doc = XDocument.Load("test.xml");
var matches = doc
.Descendants("aircraft_info")
.Where(ft => ((string)ft.Element("aircraft_name")) == "Default");
// Prints 1
Console.WriteLine(matches.Count());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment