You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.1 version.
How to subscribe to file changes?
In order to retrieve the notifications about the file changes located in a given directory use a ForFolder
method.
Syntax
IObservableWithTask<FileChangeNotification> ForFolder(string folder);
Parameters | ||
---|---|---|
folder | string | The name of a directory for which notifications will be sent. |
Return Value | |
---|---|
IObservableWithTask<FileChangeNotification> | The observable that allows to add subscriptions to received notifications |
Example
IDisposable subscription = store
.Changes()
.ForFolder("/documents/books")
.Subscribe(change =>
{
switch (change.Action)
{
case FileChangeAction.Add:
// do something
break;
case FileChangeAction.Delete:
// do something
break;
}
});
Remarks
Information
To get more method overloads, especially the ones supporting delegates, please add Reactive Extensions package to your project.