Solved

Changing LINQ to XML to Lambda to XML

Posted on 2010-11-20
2
391 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
2 Comments
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now