using System; using System.IO; class Program { static void Main(string[] args) { FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = @"C:\ExampleFolder"; watcher.Filter = "*.txt"; watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite; watcher.Created += new FileSystemEventHandler(OnChanged); watcher.EnableRaisingEvents = true; Console.WriteLine("Press any key to exit."); Console.ReadKey(); } private static void OnChanged(object source, FileSystemEventArgs e) { Console.WriteLine($"New file added: {e.FullPath}"); // Perform some task on a new file. } }In the above example, we create a new instance of the FileSystemWatcher class, set the path to the folder that we want to monitor, and set the filter to watch only for files with the ".txt" extension. We also set the NotifyFilters to watch for changes in the file name or when the file is written to. We attach an event handler to the Created event, which is triggered when a new file is created in the watched folder. The OnChanged method is called when the event is fired, and we print out the name of the new file and perform some task on it. The package library for FileSystemWatcher is in the System.IO namespace, which is part of the .NET Framework.