Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB XMLDocument.Item property equivalent in Csharp

Posted on 2011-03-12
3
Medium Priority
?
537 Views
Last Modified: 2012-05-11
I am rewriting a publicly available Bing Maps API into CSharp for practice and I have run into a problem that I need help with.  the VB Code uses a .item property to read the XML nodes, but I am not sure what the CSharp equivalent is as .item does not show up in the available methods.  (I believe I have properly referenced all assemblies.)

VB Code is below.  Thanks for the help!
Dim myJobStatus As String = myXmlDocument.Item("Response").Item("ResourceSets").Item("ResourceSet").Item("Resources").Item("DataflowJob").Item("Status").InnerText

Open in new window

0
Comment
Question by:gwarcher
[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
3 Comments
 
LVL 6

Expert Comment

by:Webmonkey
ID: 35120154
Assuming you are using the XmlDocument class (reference below), it would look like this:

String myJobStatus = myXmlDocument.Item["Response"].Item["ResourceSets"].Item["ResourceSet"].Item["Resources"].Item["DataflowJob"].Item["Status"].InnerText

Open in new window



Ref: http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx
0
 

Author Comment

by:gwarcher
ID: 35125435
I am getting the following error:  'System.Xml.XmlDocument' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Xml.XmlDocument' could be found (are you missing a using directive or an assembly reference?)

I have a reference to sytstem.xml at the top.
0
 
LVL 6

Accepted Solution

by:
Webmonkey earned 2000 total points
ID: 35156081
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

722 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