Why does this code work?

In the discussion on the Umbraco forum about using LINQ to Umbraco I posted a short code snippet of something we write fairly frequently at TheFARM using our version of LINQ with Umbraco.
I thought I’d post the challenge to my trusty followers, f…

In the discussion on the Umbraco forum about using LINQ to Umbraco I posted a short code snippet of something we write fairly frequently at TheFARM using our version of LINQ with Umbraco.
I thought I’d post the challenge to my trusty followers, for them to see if they know why the code works. First off the code:
IEnumerable<XElement> nodes = UmbXmlLinqExtensions.GetNodeByXpath(…); IEnumerable<IUmbracoPage> pages = nodes.Select(n =>(IUmbracoPage)(UmbracoPage)n); What the XPath being evaluated isn’t important, what is important is you’ll notice that we have a collection of System.


Print Share Comment Cite Upload Translate
APA
Posts on LINQ to Fail | Sciencx (2024-03-28T12:56:56+00:00) » Why does this code work?. Retrieved from https://www.scien.cx/2010/04/25/why-does-this-code-work/.
MLA
" » Why does this code work?." Posts on LINQ to Fail | Sciencx - Sunday April 25, 2010, https://www.scien.cx/2010/04/25/why-does-this-code-work/
HARVARD
Posts on LINQ to Fail | Sciencx Sunday April 25, 2010 » Why does this code work?., viewed 2024-03-28T12:56:56+00:00,<https://www.scien.cx/2010/04/25/why-does-this-code-work/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » Why does this code work?. [Internet]. [Accessed 2024-03-28T12:56:56+00:00]. Available from: https://www.scien.cx/2010/04/25/why-does-this-code-work/
CHICAGO
" » Why does this code work?." Posts on LINQ to Fail | Sciencx - Accessed 2024-03-28T12:56:56+00:00. https://www.scien.cx/2010/04/25/why-does-this-code-work/
IEEE
" » Why does this code work?." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2010/04/25/why-does-this-code-work/. [Accessed: 2024-03-28T12:56:56+00:00]
rf:citation
» Why does this code work? | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2010/04/25/why-does-this-code-work/ | 2024-03-28T12:56:56+00:00
https://github.com/addpipe/simple-recorderjs-demo