第一次使用Linq

1.数组中使用linq

public List<A_FlowPointModel> PointList;

 var result = PointList.Where(p => p.ParentPointIdList.Contains(parentPointId.ToString()) == true);

  foreach (var point in result)
        {}

2、xml 中使用linq

using System.Xml.Linq;

  string xmlPath = Server.MapPath("~/ERPA/Flow/FlowXml/") + flowId + ".xml";
  string xmlTemplatePath = Server.MapPath("~/ERPA/Flow/FlowXml/newflow.xml"); //xml模板

  XElement WebFlow = XElement.Load(xmlTemplatePath);
   WebFlow.Element("FlowConfig").Element("BaseProperties").SetAttributeValue("flowId", FlowID);
   WebFlow.Element("FlowConfig").Element("BaseProperties").SetAttributeValue("flowText", txtFlowName.Text);

 

 XElement steps=WebFlow.Element("Steps");
  XElement actions = WebFlow.Element("Actions");

      new XElement("BaseProperties",
                new XAttribute("id",point.PointID),
                new XAttribute("text",point.PointName),
                 new XAttribute("stepType", "NormalStep")),
                 XElement.Parse(@"<VMLProperties width='200' height='200' x='"+xPosition+"px' y='" +yPosition + "px' textWeight='' strokeWeight='' zIndex='40' />"),
                 new XElement("FlowProperties"));

 

posted @ 2011-05-24 17:15  张倩  阅读(348)  评论(0编辑  收藏  举报