C# – How to use FileSystemWatcher

You can use the FileSystemWatcher class to detect file system changes, such as when a file is created, deleted, modified, or renamed. When a change happens, it raises an event that you can handle. This is an event-based alternative to polling for file changes. In this article, I’ll show how to use FileSystemWatcher to detect … Read more

C# – Example of using events

Events are an implementation of the observer pattern and consists of two parts: There are three simple steps to using events, which I’ll show below. 1 – Add an event field The first step is to add an event field to a class with the event keyword and a delegate type (such as the generic … Read more