xmllinqcompiled-query

Linq to XML compiled queries


Is it possible to change this Linq to XML statement into a compiled query ?

myxmlnodeList2 = From el In mynode.<attributwert> 
                 Where el.Attribute("AttributID") = sAttributID.ToLower And el.Attribute("Verwendung") = sVerwendung 
                 Select el

I used this method: Msdn

This works perfectly, if I only have 1 single Where condition. So, how can I create a compiled query with 2 Where conditions?


Solution

  • This already is a compiled query.

    Quote from the MSDN:

    queries in LINQ to XML are statically compiled [...]. This feature is built in to LINQ to XML, so you do not have to perform extra steps to take advantage of it