using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
class Program
{
static void Main()
{
string xml = @"603";
XElement config = XElement.Parse(xml);
XElement client = config.Element("client");
int timeout = (int)client.Element("timeout"); // Read element
Console.WriteLine (timeout); // 30
client.Element ("timeout").SetValue (timeout * 2); // Update element
client.Add(new XElement("retries", 3)); // Add new element
Console.WriteLine(config); // Implicitly call config.ToString()
}
}
The output:
60
12033