Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 364935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:29:10+00:00 2026-05-12T13:29:10+00:00

I am a C# programmer, so I don’t get to take advantage of the

  • 0

I am a C# programmer, so I don’t get to take advantage of the cool XML syntax in VB.

Dim itemList1 = From item In rss.<rss>.<channel>.<item> _
                Where item.<description>.Value.Contains("LINQ") Or _
                      item.<title>.Value.Contains("LINQ")

Using C#, I find XPath to be easier to think about, easier to code, easier to understand, than performing a multi-nested select using LINQ to XML. Look at this syntax, it looks like Greek swearing:

var waypoints = from waypoint in gpxDoc.Descendants(gpx + "wpt") 
          select new 
          { 
            Latitude = waypoint.Attribute("lat").Value, 
            Longitude = waypoint.Attribute("lon").Value, 
            Elevation = waypoint.Element(gpx + "ele") != null ? 
                waypoint.Element(gpx + "ele").Value : null, 
            Name = waypoint.Element(gpx + "name") != null ? 
                waypoint.Element(gpx + "name").Value : null, 
            Dt = waypoint.Element(gpx + "cmt") != null ? 
                waypoint.Element(gpx + "cmt").Value : null 
          }; 

All the casting, the heavy syntax, the possibility for NullPointerExceptions. None of this happens with XPath.

I like LINQ in general, and I use it on object collections and databases, but my first go-round with querying XML led me right back to XPath.

Is it just me?

Am I missing something?


EDIT: someone voted to close this as “not a real question”. But it is a real question, stated clearly. The question is: Am I misunderstanding
something with LINQ to XML?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:29:11+00:00Added an answer on May 12, 2026 at 1:29 pm

    Use what you feel the most comfortable with, as long as it gets the job done. I use both methods depending on what I need to do to with XML. It sounds to me like you’ve got a good handle on what LINQ is good for and what XPath is good for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all C experts (please don't shoot, I'm no C programmer anymore but from
I am a Java programmer, and I am learning Ruby... But I don't get
Now, don't get me wrong, I am a very competent programmer, but when I
I am a self thought hobby programmer and therefore don't have the fundamentals always
hobbyist/non-profession programmer here. I don't have a strong grasp on network addressing. I have
This should really be easy for an experienced android programmer. Unfortunately I don't know
I beginer programmer,and don't have any QA experience (only simple test that i write
I'm not a professional programmer, so please don't hesitate to state the obvious. My
Previously I'm a C programmer(wanna know more about system programming but don't wanna go
I don't get it. If I want to change the text on a button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.