Class ChangeWatch
A class for watching for various kinds of changes, especially for determining when configuration should be reread from changed configuration files.
public class ChangeWatch
- Inheritance
-
ChangeWatch
- Inherited Members
Constructors
ChangeWatch()
Initializes a new instance of the ChangeWatch class.
public ChangeWatch()
Remarks
UtcNow is used to retrieve the current system time.
ChangeWatch(Func<DateTime>)
Initializes a new instance of the ChangeWatch class.
public ChangeWatch(Func<DateTime> utcNowFunc)
Parameters
Exceptions
- ArgumentNullException
utcNowFunc
is null.
Properties
IsChanged
Gets whether a change of some kind has occurred.
public bool IsChanged { get; }
Property Value
TimeInterval
Gets or sets a time interval that triggers a change "notification." A null value disables this.
public TimeSpan? TimeInterval { get; set; }
Property Value
WatchFileName
Gets or sets the full path to a file to watch for changes. A null value disables this.
public string WatchFileName { get; set; }
Property Value
Remarks
As long as the file does not exist or the file's last write time cannot be read for any reason, the change will not be noted. No exceptions will be issued. The caller should check for the file's if necessary.
Methods
Reset()
Resets the change watcher.
public void Reset()