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:


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

This will do it.


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

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.