I am trying to copy data of one file and pasting it into the same file which means overwriting it. I learn that overwrite the file data using file.copy() cannot be possible. but from the one of the post says that if I use File.Copy(Source file, destination file, true) than overwrite is possible. I tried to use but it didn't work. if anyone have solution for that than it will be big help.
public void EditRole(string oldRole, string newRole) { if (File.Exists(roleXMLLoc)) { XDocument doc = XDocument.Load(roleXMLLoc); var edit = doc.Element("Roles").Elements("Role").Where(x => x.Value == oldRole).SingleOrDefault(); edit.Value = newRole; doc.Save(roleXMLLoc); if (File.Exists(userPermissionLoc)) { File.Copy(userPermissionLoc, userPermissionLoc, true); SaveData(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)