Hello everyone, I'm new to Linq and having some strange results when I try to perform a query using where.
Example of the xml:
<movies>
<movie id="1">
<scenes>
<scene id="1">
<sceneartistsnames>
<sceneartistname>Artist A</sceneartistname>
</sceneartistsnames>
</scene>
<scene id="2">
<sceneartistsnames>
<sceneartistname>Artist B</sceneartistname>
</sceneartistsnames>
</scene>
</scenes>
</movie>
<movie id="10">
<scenes>
<scene id="1">
<sceneartistsnames>
<sceneartistname>Artist B</sceneartistname>
<sceneartistname>Artist A</sceneartistname>
</sceneartistsnames>
</scene>
</scenes>
</movie>
</movies>
Now trying to select all the scenes where Artist A is part of it.
Dim Results = From MovieWithArtist In MoviesXML...<scene> _
Where MovieWithArtist.<sceneartistsnames>.<sceneartistname>.Value = "Artist A" _
Select MovieWithArtist
I only get one scene return, and I was expecting two. :(
Now if I change the second scene in the XML to:
<movie id="10">
<scenes>
<scene id="1">
<sceneartistsnames>
<sceneartistname>Artist A</sceneartistname>
<sceneartistname>Artist B</sceneartistname>
</sceneartistsnames>
</scene>
</scenes>
</movie>
Then I get two scenes return.
What I am doing wrong?
Thank you everyone.