My LINQ query returns only the first result (class). Here is the code I'm using:
XDocument xmlDoc = XDocument.Load("Decks/Test.xml");
List<Cards> tempdeck = (from deck in xmlDoc.Elements("Deck")
select new Cards
{
Name = deck.Element("Type").Value
}).ToList<Cards>();
foreach (var item in tempdeck)
{
((MessageBroker)App.Current.Resources["MessageBroker"]).GameLog.Add(item.Name.ToString());
}
This is what my XML file looks like:
<Deck>
<Type>
<Name>Class</Name>
</Type>
<Type>
<Name>stsfs</Name>
</Type>
<Type>
<Name>Class</Name>
</Type>
<Type>
<Name>Class</Name>
</Type>
</Deck>
I format it this way, because when I get it to work, I want to add several properties to the request, not just the name.
Thanks in advance!
source
share