专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > DotNet Exception

linq出错如何解决

发布时间:2011-06-26 20:27:46 文章来源:www.iduyao.cn 采编人员:星星草

linq出错如何解决?

以下代码 没有查询出想要的结果 如何修改

想要查询的内容是 <Layout direction="Vertical"> 这个小结


代码部分

  XName Form = "Form", Id = "id", Control = "Control", Layout = "Layout", direction = "direction", Location = "Location", x = "x", y = "y", Size="Size",width = "width", height = "height";
  string FormID = "FormLogin", ControlID = "panelMain", Direction = "Vertical";

  //IEnumerable <string> partNos =  Elements
  var LocationList =  from Forms in Root.Elements(Form)
    where
    ( (string)Forms.Attribute(Id) == FormID  &&
    (string)Forms.Element(Control).Attribute(Id) == ControlID &&
   
    (string)Forms.Element(Control).Element(Layout).Attribute(direction) == Direction
    )
    select new{
    X =(int)Forms.Element(Control).Element(Layout).Element(Location).Element(x),
    Y =(int)Forms.Element(Control).Element(Layout).Element(Location).Element(y),
    Width = (int)Forms.Element(Control).Element(Layout).Element(Size).Element(width),
    Height = (int)Forms.Element(Control).Element(Layout).Element(Size).Element(height),     

友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: