[Solved] c# linq to xml subnodes query [closed]


Do you mean something like this:

var song = "foo2.mp3";
var number = 2;

var query =
    from x in xd.Root.Elements("file")
    where x.Element("song").Value == song
    from y in x.Elements("listen")
    where (int)y.Element("number") == number
    select y.Element("data");

Which would give you:

result

solved c# linq to xml subnodes query [closed]