Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing LINQ to XML to Lambda to XML

Posted on 2010-11-20
2
Medium Priority
?
401 Views
Last Modified: 2012-06-27
Can I write these using a Lambda expression?:

            var query = from xElem in doc.Descendants("Patient")
                        select new Patient(xElem);


            XElement xml = new XElement("Patients",
                from p in this
                select p.XElement);
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 2000 total points
ID: 34181530
No, lambda expressions themselves are not a replacement for LINQ. I think that you mean extension methods, which use lambda expressions as part of the syntax:

var query = doc.Descendants("Patient").Select(xElem => new Patient(xElem);

XElement xml = new XElement("Patient", this.Select(p => p.XElement));

Open in new window

0
 

Author Closing Comment

by:newbieweb
ID: 34181590
Thanks a lot!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question