Why this code wont work? XML with .StartsWith

Mas11

New Member
Why this work like this:\[code\] XDocument dataFeed = XDocument.Parse(e.Result); var guide = from query in dataFeed.Descendants("MaxPayne3") select new NewGamesClass { GameID = (string)query.Element("ID"), GameTitle = (string)query.Element("Title"), GameDescription = (string)query.Element("Description"), GameGuide = (string)query.Element("Guide") }; if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex)) { if (selectedIndex == "0") GuidesListBox.ItemsSource = guide.Where(ngc => ngc.GameTitle.StartsWith("Feel")); else if (selectedIndex == "1") GuidesListBox.ItemsSource = guide.Where(ngc => ngc.GameTitle.StartsWith("Serious"));\[/code\]But not like this:\[code\] if (selectedIndex == "0") GuidesListBox.ItemsSource = guide.Where(ngc => ngc.GameID.StartsWith("000")); else if (selectedIndex == "1") GuidesListBox.ItemsSource = guide.Where(ngc => ngc.GameID.StartsWith("001"));\[/code\]i want to use the GameID Instead The GameTitle.Sorry about no XML, too early in the morning for me, lolHere:https://dl.dropbox.com/u/27136243/AchivementHunters/XML/GameList.xmlHere is the Class:\[code\]public class NewGamesClass{ string gameID; string gameTitle; string gamedescription; string gameImage; string gameGuide; string videoLink; public string GameID { get { return gameID; } set { gameID = value; } } public string GameTitle { get { return gameTitle; } set { gameTitle = value; } } public string GameDescription { get { return gamedescription; } set { gamedescription = value; } } public string GameImage { get { return gameImage; } set { gameImage = value; } } public string GameGuide { get { return gameGuide; } set { gameGuide = value; } } public string VideoLink { get { return videoLink; } set { videoLink = value; } }}\[/code\]
 
Back
Top