How to read a string in xml and compare to C#?

My question is how to read the xml file on the website, and to check the values in the program itself

For example, the structure in the xml file
<?xml version="1.0" encoding="utf-8" ?>

You need to read the line suggestions and do a check if the value is true then the button is active, if false then the button is inactive

The code in the program
private void Main_Load(object sender, EventArgs e)
 Serverdoc XmlDocument = new XmlDocument();
 // then what to write?
August 19th 19 at 22:35
1 answer
August 19th 19 at 22:37
var doc = XElement.Load("http://мойсайт.ru/version.xml");
var result = bool.Parse(doc.Element("suggestions").Value);

XmlDocument is an outdated approach.
And even better is to deserialize into an object.
How to check what is written
if (doc == true)
// Action if match
} - neal.Strosin commented on August 19th 19 at 22:40
: if(result){ //Action if matched } - candelario.Johnson commented on August 19th 19 at 22:43
And here NRE due to the fact that there is no xml element suggestions) - Mckenna.Feest commented on August 19th 19 at 22:46

Find more questions by tags C#Visual StudioXML