Skip to content

Instantly share code, notes, and snippets.

@benbhall benbhall/ExampleOnCreated.cs Secret
Created Nov 7, 2017

What would you like to do?
using System;
using System.IO;
namespace ConsoleApp
public class SomeService
private FileSystemWatcher _watcher;
public void OnStart()
_watcher = new FileSystemWatcher();
_watcher.Path = @"c:\temp";
_watcher.NotifyFilter = NotifyFilters.FileName;
_watcher.Filter = "*.*";
_watcher.Created += new FileSystemEventHandler(OnCreated);
_watcher.EnableRaisingEvents = true;
private void OnCreated(object source, FileSystemEventArgs e)
class Program
static void Main(string[] args)
var thing = new SomeService();

This comment has been minimized.

Copy link

sid-zupa commented Nov 11, 2019


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.