我有一个查询,应从返回一个5行,其中使用linq2xml在Windows手机应用程序查询我尝试子句LINQ查询使用其中的Windows Phone应用程序条款
XDocument loadedCustomData = XDocument.Load("pincodes.xml");`
var filteredData = from c in loadedCustomData.Descendants("record")`
where c.Attribute("PON").Equals ("Adapur")`
select new pincodes1()
{
PON = c.Attribute("PostOfficeName").Value,
PIN = c.Attribute("Pincode").Value,
DIS = c.Attribute("Districts").Value,
CT = c.Attribute("City").Value,
ST = c.Attribute("State").Value
};
listBox1.ItemsSource = filteredData;
但随后它给系统的空异常有啥错在查询 这里的截图
,这是类文件
namespace pincodes
{
class pincodes1
{
string PostOfficeName;
string Pincode;
string Districts;
string City;
string State;
public string PON
{
get { return PostOfficeName; }
set { PostOfficeName = value; }
}
public string PIN
{
get { return Pincode; }
set { Pincode = value; }
}
public string DIS
{
get { return Districts; }
set { Districts = value; }
}
public string CT
{
get { return City; }
set { City = value; }
}
public string ST
{
get { return State; }
set { State = value; }
}
}
}
那么,什么是在LINQ查询
什么是内部异常? – Damith
我附上截图,它给出了错误,你可以检查它 – SD7