Solved

Changing LINQ to XML to Lambda to XML

Posted on 2010-11-20
2
388 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
Comment Utility
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
Comment Utility
Thanks a lot!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

11 Experts available now in Live!

Get 1:1 Help Now