if (File.Exists(path)) { XElement xml = new XElement("Users", new XElement("User", new XElement("UserName", txtUserName.Text), new XElement("Password", txtpassword.Text), new XElement("Role", Role))); xml.Save(path); MessageBox.Show("Saved"); }
//this is result <Users> <User> <UserName>admin</UserName> <Password>admin</Password> <Role>Admin</Role> </User> </Users> //I want below result <Users> <User> <UserName>admin</UserName> <Password>admin</Password> <Role>Admin</Role> </User> <User> <UserName>test</UserName> <Password>test</Password> <Role>User</Role> </User> </Users>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)