Muokkaa

Jaa


IFileChangeNotificationSystem.StartMonitoring Method

Definition

Registers a file path to monitor with the host environment.

public:
 void StartMonitoring(System::String ^ filePath, System::Runtime::Caching::OnChangedCallback ^ onChangedCallback, [Runtime::InteropServices::Out] System::Object ^ % state, [Runtime::InteropServices::Out] DateTimeOffset % lastWriteTime, [Runtime::InteropServices::Out] long % fileSize);
public void StartMonitoring (string filePath, System.Runtime.Caching.OnChangedCallback onChangedCallback, out object state, out DateTimeOffset lastWriteTime, out long fileSize);
abstract member StartMonitoring : string * System.Runtime.Caching.OnChangedCallback * obj * DateTimeOffset * int64 -> unit
Public Sub StartMonitoring (filePath As String, onChangedCallback As OnChangedCallback, ByRef state As Object, ByRef lastWriteTime As DateTimeOffset, ByRef fileSize As Long)

Parameters

filePath
String

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

onChangedCallback
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
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(String, Object) method.

lastWriteTime
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
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.

Remarks

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.

Applies to