private static void OnRenamed(object sender, RenamedEventArgs e) { Console.WriteLine($"Renamed {e.OldName} to {e.Name}"); } static void Main(string[] args) { FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = @"C:\Users\"; watcher.Filter = "*.txt"; watcher.Renamed += new RenamedEventHandler(OnRenamed); watcher.EnableRaisingEvents = true; Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }In this code example, we create a FileSystemWatcher object to monitor a directory for changes in any .txt files. When a file is renamed, the OnRenamed method is called and prints the old and new names of the file. The package library for System.IO RenamedEventArgs is part of the .NET Framework Class Library, which is included in the .NET Framework installation.