请咨询之前检查空值。 这是代码的Linq:访问属性有关错误
void Main()
{
var a = from id in TechnicalProducts
where id.Id == "ID-4591"
select new {
Country = id.Computers.Select (x => new {x.Location.ParentLocation.ParentLocation.ParentLocation.ParentLocation.Code}),
};
Console.WriteLine(a);
}
错误:由导航属性“代码”返回一个项为无效,不能初始化。你应该检查空值,访问此属性之前
但如果将我加入这行? – Swapnil 2012-07-20 17:22:03
请检查我的帖子。 – 2012-07-21 04:37:39