Sorry for the noob-sounding question, but I'm doing a project for school where I need to query some data from an XML file, a format that i have exactly zero experience with so I'm not sure I'm doing it right.
After checking out a bunch of different languages, I decided that the C# library LINQ to XML looks like the easiest, syntactically speaking, to work with so I'm gonna roll with it. I've never really worked in C# before but I have a ton of experience in Java, C, and C++ so I'm confident I can pick it up quickly.
It was my understanding that the library already came with C# when I downloaded the language when I first installed Visual Studio (Which I have never worked with before this class I'm in now so I'm not sure 100% how it works.)
After checking out a tutorial, I was alerted that I could utilize the library by including using System.Xml.Linq
. However, when I tried the basic command XDocument xmlDocument = new XDocument()
, I got an error that "XDocument" could not be found, and another error that Linq
doesn't exist within the System.Xml
namespace.
I'm really stuck because it's pretty much the consensus that our professor isn't very good and I've asked around but nobody in the class really knows what to do so asking my peers hasn't been any help.
Thanks for your patience and any available help you guys can give me.
Go to project references and add a reference to System.Xml.Linq
:
How to: Add or Remove References By Using the Add Reference Dialog Box
I think you are confused.
System.Xml
and System.Xml.Linq
are two different references.
You will have to add System.Xml.Linq
, then call using System.Xml.Linq
in your namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With