Solved

Changing LINQ to XML to Lambda to XML

Posted on 2010-11-20
2
398 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 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

Technology Partners: 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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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