IFileChangeNotificationSystem.StartMonitoring Method (String, OnChangedCallback, Object, DateTimeOffset, Int64)

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Registers a file path to monitor with the host environment.

Namespace:   System.Runtime.Caching.Hosting
Assembly:  System.Runtime.Caching (in System.Runtime.Caching.dll)

void StartMonitoring(
	string filePath,
	OnChangedCallback onChangedCallback,
	out object state,
	out DateTimeOffset lastWriteTime,
	out long fileSize
)

Parameters

filePath
Type: System.String

The fully qualified physical path of a directory or file to monitor for changes.

onChangedCallback
Type: System.Runtime.Caching.OnChangedCallback

A reference to a method that implements the OnChangedCallback delegate. When the monitored file or directory changes, the host environment's implementation of the IFileChangeNotificationSystem interface raises an event by calling the OnChangedCallback class.

state
Type: System.Object

The state that is supplied by the host environment. Cache implementations and custom change monitors should treat the state value as opaque. However, the state must be stored so that it can be sent to the host environment when the cache implementation calls the StopMonitoring method.

lastWriteTime
Type: System.DateTimeOffset

When this method returns, contains the last date and time that a write operation occurred on filePath. This parameter is passed uninitialized. This parameter is returned from the host environment.

fileSize
Type: System.Int64

When this method returns, contains the total size of the monitored filePath. This parameter is passed uninitialized. This parameter is returned from the host environment.

This method is used by custom cache objects and custom change monitors that implement the host environment's IFileChangeNotificationSystem interface in order to register file paths for monitoring with the host environment. The StartMonitoring method is called by implementers of the IFileChangeNotificationSystem interface in order to register a file or directory for change monitoring.

.NET Framework
Available since 4.0
Return to top
Show: