C# Class Brass9.Threading.TimerInfo

A wrapper class for System.Threading.Timer * Eliminates context object to pass in - just use a closure instead. * Allows you to check on the current Interval the timer is set to. * Uses just the one callback per timer - if you need a new callback, make a new TimerInfo. * Simplifies changing schedule of timer. * Easier to check on when it ran (check LastFired).
Show file Open project: b9chris/ASP.Net-Long-Running-Interval-Task Class Usage Examples

Protected Properties

Property Type Description
timer System.Threading.Timer
timerCallback System.Action

Public Methods

Method Description
SetInterval ( int milliseconds ) : void
Stop ( ) : void
TimerInfo ( System.Action timerCallback ) : System

Setup a TimerInfo object.

Method Details

SetInterval() public method

public SetInterval ( int milliseconds ) : void
milliseconds int
return void

Stop() public method

public Stop ( ) : void
return void

TimerInfo() public method

Setup a TimerInfo object.
public TimerInfo ( System.Action timerCallback ) : System
timerCallback System.Action The Action to call each time the Timer fires. Does away with a context object argument - use a closure instead.
return System

Property Details

timer protected property

protected Timer,System.Threading timer
return System.Threading.Timer

timerCallback protected property

protected Action,System timerCallback
return System.Action