linq

single record get
===================

http://www.codeproject.com/Answers/182358/Linq-to-xml-output-element-value.aspx#answer1


http://www.dotnetperls.com/convert-milliseconds-seconds-minutes

http://rumandcode.wordpress.com/2008/09/03/multiple-join-fields-in-linq/

http://msdn.microsoft.com/en-us/library/bb397941.aspx


slibinlig
http://msdn.microsoft.com/en-us/library/bb675160.aspx

http://www.java2s.com/Code/XML/XSLT-stylesheet/precedingsiblingandfollowingsibling.htm

IEnumerable status = from obj in xmlDoc.Descendants("AvailFlt")
where (string)obj.Element("AirV") == (string)elementchild.Element("AirV") && (string)obj.Element("FltNum") == (string)elementchild.Element("FltNum")
&& (string)obj.Element("StartAirp") == (string)elementchild.Element("StartPt") && (string)obj.Element("EndAirp") == (string)elementchild.Element("EndPt")
&& (string)obj.Element("StartTm") == (string)elementchild.Element("StartTm") && (string)obj.Element("StartDt") == (string)elementchild.Element("StartDt")
&& (string)obj.Element("EndTm") == (string)elementchild.Element("EndTm")
select obj;






//XElement single;
//if (status.Count() == 0)
//{
// //handle no elements returned
//}
//else if (status.Count() > 1)
//{
// //handle more than 1 elements returned
//}
//else
//{
XElement single = status.Single();
//}

XElement el2 = ((IEnumerable)single
.XPathEvaluate("following-sibling::*[1]"))
.Cast()
.First();

No comments:

Post a Comment