Solved

VB XMLDocument.Item property equivalent in Csharp

Posted on 2011-03-12
3
535 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 500 total points
ID: 35156081
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

623 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