Skip to main content

Create Section With Complex Linq query



I'm trying to create a section with linq from xml file. my xml file build like this:







<root>

<Item>

<name>a</name>

<status>new</status>

</Item>

<Item>

<name>b</name>

<status>old</status>

</Item>



</root>







I want to create the section by the following way if the status tag = "new it will create an entry element and if its old it will create a stringelement





i thought of something like this







new section()

{

from x in myXdoc.Descendants("Item")

where x.element("Status").value == "new" || x.element("Status").value == "old"



??????



}




Comments

Popular posts from this blog

Wildcards in a hosts file

I want to setup my local development machine so that any requests for *.local are redirected to localhost . The idea is that as I develop multiple sites, I can just add vhosts to Apache called site1.local , site2.local etc, and have them all resolve to localhost , while Apache serves a different site accordingly.