Linq C# to VB conversion select new...

I want to convert this Linq from C# to VB:

        var query = from employeeElement in parentElement.Descendants("Employee")
                    select new
                    {
                        Name = employeeElement.Attribute("name").Value,
                        Telephone = employeeElement.Attribute("telephone").Value
                    };

If important, this is from 4guysfrom rolla's download:
http://aspnet.4guysfromrolla.com/articles/042308-1.aspx

Thanks!

LVL 2
Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?
 
Fernando SotoRetiredCommented:
Hi BobCSD;

This will do it.

Fernando





Dim query = From employeeElement In parentElement.Descendants("Employee") _
            Select New With { _
                              .Name = employeeElement.Attribute("name").Value, _
                              .Telephone = employeeElement.Attribute("telephone").Value _
                            }

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.