I am using FileSystemWatcher
On the Changed Event, I want to pass an integer variable.
e.g.
int count = someValue;
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = "C:\temp";
watcher.Changed += new FileSystemEventHandler(fileSystemWatcher_Changed);
on the fileSystemWatcher_Changed, I want to take the count value and then do some work.
But how do I get that value.
if I make count a global variable, it wouldn’t be valid because count changes with each file changed event and it is passed from user.
The simplest approach is to use a lambda expression:
It sounds like you may want to pass
countby reference though, if the method wants to update the value.