I have a xml file which i have to load in richtextbox in wpf. if some changes occure in txt file then it will save in different path automatically after a time interval of 1 min. Let the 1st changes happens in 10:11 then all the changes made up to 10:12 will save.File creation time will be 10:12 then again the richtextbox will be modified at 10:50 then the file modified time will be 10:51.The loading and the saving path is different.
  private void startSaveTimer()
    {
        Timer saveTimer = new Timer(60000);
        saveTimer.Elapsed += saveTimer_Elapsed;
        saveTimer.Start();
    }
    private void saveTimer_Elapsed(object sender, ElapsedEventArgs e)
    {
        string filepath = @"C:\mydoc.txt";//file save path
        if (File.Exists(filepath))
        {
            FileStream file = new FileStream(filepath, FileMode.Open);
            //geting the content  from file and compare with richtextbox data
            //if not same then saving it again
        }
       else
       {
        //save file
       }
    }
    private void richText_TextChanged(object sender, TextChangedEventArgs e)
    {
        startSaveTimer();
    }
but this code calledin each single changed  so
FileStream file = new FileStream(filepath, FileMode.Open); is showing error  as used by different user. try to keep lock still got the same error.