Monday, 7 July 2014

xml to linq query where letter starts with a in windows phone



i am trying to fetch data where all words starting with A and displaying it listbox using xml to LINQ, but the Startwith property i am not able acheve here is the code i am trying to fetch



XDocument loadedCustomData = XDocument.Load("accounts.xml");
var filteredData =
from c in loadedCustomData.Descendants("record")

where (string)c.Element("main") == "Above the Line"
// i want here something like
//where (string)c.element("main").startwith ==a
//so how to ACHIEVE THIS????
select new words()
{

PON = "Post Office: " + (string)c.Element("main"),
PIN = "Pincode (Postal Code): " + (string)c.Element("def"),

};
listBox1.ItemsSource = filteredData;


SO HOW TO ACHIEVE THE QUERY TO START WITH LETTER A


No comments:

Post a Comment