mscorlib(4.0.0.0) API with additions
|
Provides a mechanism for executing a method on a thread pool thread at specified intervals. This class cannot be inherited.To browse the .NET Framework source code for this type, see the Reference Source. More...
Public Member Functions | |
Timer (TimerCallback callback, object state, int dueTime, int period) | |
Initializes a new instance of the Timer class, using a 32-bit signed integer to specify the time interval. More... | |
Timer (TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period) | |
Initializes a new instance of the Timer class, using T:System.TimeSpan values to measure time intervals. More... | |
Timer (TimerCallback callback, object state, uint dueTime, uint period) | |
Initializes a new instance of the Timer class, using 32-bit unsigned integers to measure time intervals. More... | |
Timer (TimerCallback callback, object state, long dueTime, long period) | |
Initializes a new instance of the Timer class, using 64-bit signed integers to measure time intervals. More... | |
Timer (TimerCallback callback) | |
Initializes a new instance of the T:System.Threading.Timer class with an infinite period and an infinite due time, using the newly created T:System.Threading.Timer object as the state object. More... | |
bool | Change (int dueTime, int period) |
Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals. More... | |
bool | Change (TimeSpan dueTime, TimeSpan period) |
Changes the start time and the interval between method invocations for a timer, using T:System.TimeSpan values to measure time intervals. More... | |
bool | Change (uint dueTime, uint period) |
Changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals. More... | |
bool | Change (long dueTime, long period) |
Changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals. More... | |
bool | Dispose (WaitHandle notifyObject) |
Releases all resources used by the current instance of T:System.Threading.Timer and signals when the timer has been disposed of. More... | |
void | Dispose () |
Releases all resources used by the current instance of T:System.Threading.Timer. More... | |
![]() | |
object | GetLifetimeService () |
Retrieves the current lifetime service object that controls the lifetime policy for this instance. More... | |
virtual object | InitializeLifetimeService () |
Obtains a lifetime service object to control the lifetime policy for this instance. More... | |
virtual ObjRef | CreateObjRef (Type requestedType) |
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. More... | |
Additional Inherited Members | |
![]() | |
MarshalByRefObject | MemberwiseClone (bool cloneIdentity) |
Creates a shallow copy of the current T:System.MarshalByRefObject object. More... | |
Provides a mechanism for executing a method on a thread pool thread at specified intervals. This class cannot be inherited.To browse the .NET Framework source code for this type, see the Reference Source.
System.Threading.Timer.Timer | ( | TimerCallback | callback, |
object | state, | ||
int | dueTime, | ||
int | period | ||
) |
Initializes a new instance of the Timer
class, using a 32-bit signed integer to specify the time interval.
callback | A T:System.Threading.TimerCallback delegate representing a method to be executed. |
state | An object containing information to be used by the callback method, or null . |
dueTime | The amount of time to delay before callback is invoked, in milliseconds. Specify F:System.Threading.Timeout.Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. |
period | The time interval between invocations of callback , in milliseconds. Specify F:System.Threading.Timeout.Infinite to disable periodic signaling. |
T:System.ArgumentOutOfRangeException | The dueTime or period parameter is negative and is not equal to F:System.Threading.Timeout.Infinite. |
T:System.ArgumentNullException | The callback parameter is null . |
System.Threading.Timer.Timer | ( | TimerCallback | callback, |
object | state, | ||
TimeSpan | dueTime, | ||
TimeSpan | period | ||
) |
Initializes a new instance of the Timer
class, using T:System.TimeSpan values to measure time intervals.
callback | A delegate representing a method to be executed. |
state | An object containing information to be used by the callback method, or null . |
dueTime | The amount of time to delay before the callback parameter invokes its methods. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately. |
period | The time interval between invocations of the methods referenced by callback . Specify negative one (-1) milliseconds to disable periodic signaling. |
T:System.ArgumentOutOfRangeException | The number of milliseconds in the value of dueTime or period is negative and not equal to F:System.Threading.Timeout.Infinite, or is greater than F:System.Int32.MaxValue. |
T:System.ArgumentNullException | The callback parameter is null . |
System.Threading.Timer.Timer | ( | TimerCallback | callback, |
object | state, | ||
uint | dueTime, | ||
uint | period | ||
) |
Initializes a new instance of the Timer
class, using 32-bit unsigned integers to measure time intervals.
callback | A delegate representing a method to be executed. |
state | An object containing information to be used by the callback method, or null . |
dueTime | The amount of time to delay before callback is invoked, in milliseconds. Specify F:System.Threading.Timeout.Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. |
period | The time interval between invocations of callback , in milliseconds. Specify F:System.Threading.Timeout.Infinite to disable periodic signaling. |
T:System.ArgumentOutOfRangeException | The dueTime or period parameter is negative and is not equal to F:System.Threading.Timeout.Infinite. |
T:System.ArgumentNullException | The callback parameter is null . |
System.Threading.Timer.Timer | ( | TimerCallback | callback, |
object | state, | ||
long | dueTime, | ||
long | period | ||
) |
Initializes a new instance of the Timer
class, using 64-bit signed integers to measure time intervals.
callback | A T:System.Threading.TimerCallback delegate representing a method to be executed. |
state | An object containing information to be used by the callback method, or null . |
dueTime | The amount of time to delay before callback is invoked, in milliseconds. Specify F:System.Threading.Timeout.Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. |
period | The time interval between invocations of callback , in milliseconds. Specify F:System.Threading.Timeout.Infinite to disable periodic signaling. |
T:System.ArgumentOutOfRangeException | The dueTime or period parameter is negative and is not equal to F:System.Threading.Timeout.Infinite. |
T:System.NotSupportedException | The dueTime or period parameter is greater than 4294967294. |
System.Threading.Timer.Timer | ( | TimerCallback | callback | ) |
Initializes a new instance of the T:System.Threading.Timer class with an infinite period and an infinite due time, using the newly created T:System.Threading.Timer object as the state object.
callback | A T:System.Threading.TimerCallback delegate representing a method to be executed. |
bool System.Threading.Timer.Change | ( | int | dueTime, |
int | period | ||
) |
Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.
dueTime | The amount of time to delay before the invoking the callback method specified when the T:System.Threading.Timer was constructed, in milliseconds. Specify F:System.Threading.Timeout.Infinite to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. |
period | The time interval between invocations of the callback method specified when the T:System.Threading.Timer was constructed, in milliseconds. Specify F:System.Threading.Timeout.Infinite to disable periodic signaling. |
true
if the timer was successfully updated; otherwise, false
.T:System.ObjectDisposedException | The T:System.Threading.Timer has already been disposed. |
T:System.ArgumentOutOfRangeException | The dueTime or period parameter is negative and is not equal to F:System.Threading.Timeout.Infinite. |
Changes the start time and the interval between method invocations for a timer, using T:System.TimeSpan values to measure time intervals.
dueTime | A T:System.TimeSpan representing the amount of time to delay before invoking the callback method specified when the T:System.Threading.Timer was constructed. Specify negative one (-1) milliseconds to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. |
period | The time interval between invocations of the callback method specified when the T:System.Threading.Timer was constructed. Specify negative one (-1) milliseconds to disable periodic signaling. |
true
if the timer was successfully updated; otherwise, false
.T:System.ObjectDisposedException | The T:System.Threading.Timer has already been disposed. |
T:System.ArgumentOutOfRangeException | The dueTime or period parameter, in milliseconds, is less than -1. |
T:System.NotSupportedException | The dueTime or period parameter, in milliseconds, is greater than 4294967294. |
bool System.Threading.Timer.Change | ( | uint | dueTime, |
uint | period | ||
) |
Changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals.
dueTime | The amount of time to delay before the invoking the callback method specified when the T:System.Threading.Timer was constructed, in milliseconds. Specify F:System.Threading.Timeout.Infinite to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. |
period | The time interval between invocations of the callback method specified when the T:System.Threading.Timer was constructed, in milliseconds. Specify F:System.Threading.Timeout.Infinite to disable periodic signaling. |
true
if the timer was successfully updated; otherwise, false
.T:System.ObjectDisposedException | The T:System.Threading.Timer has already been disposed. |
bool System.Threading.Timer.Change | ( | long | dueTime, |
long | period | ||
) |
Changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals.
dueTime | The amount of time to delay before the invoking the callback method specified when the T:System.Threading.Timer was constructed, in milliseconds. Specify F:System.Threading.Timeout.Infinite to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. |
period | The time interval between invocations of the callback method specified when the T:System.Threading.Timer was constructed, in milliseconds. Specify F:System.Threading.Timeout.Infinite to disable periodic signaling. |
true
if the timer was successfully updated; otherwise, false
.T:System.ObjectDisposedException | The T:System.Threading.Timer has already been disposed. |
T:System.ArgumentOutOfRangeException | The dueTime or period parameter is less than -1. |
T:System.NotSupportedException | The dueTime or period parameter is greater than 4294967294. |
bool System.Threading.Timer.Dispose | ( | WaitHandle | notifyObject | ) |
Releases all resources used by the current instance of T:System.Threading.Timer and signals when the timer has been disposed of.
notifyObject | The T:System.Threading.WaitHandle to be signaled when the Timer has been disposed of. |
true
if the function succeeds; otherwise, false
.T:System.ArgumentNullException | The notifyObject parameter is null . |
void System.Threading.Timer.Dispose | ( | ) |
Releases all resources used by the current instance of T:System.Threading.Timer.
Implements System.IDisposable.