Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Last Day of Month Only

$
0
0

Would someone be kind enough to show me the necessary code to create a MonthlyTrigger on the last day of the month only?  MonthlyTrigger() no longer appears to be a valid constructor, and it appears MonthlyTrigger(int dayOfMonth, MonthsOfTheYear monthsOfYear) is the only valid constructor now, resulting in a forced providing of a hard day upon initialization.

The first parameter, dayOfMonth, must be a value between 1 and 31, which results in the DaysOfMonth property containing whatever value was passed at initiation. Null cannot be passed at initiation, and attempting to set DaysOfMonth to a null value after the constructor causes an exception.

I would prefer not to have to specify a hard date while initiating, as this would cause problems in February every leap year.

MonthlyTrigger mt = new MonthlyTrigger(31, this.Trigger.Months);
mt.RunOnLastDayOfMonth = true;

 

The code above results in a trigger for both the 31st and the Last day of the month.


Viewing all articles
Browse latest Browse all 2206

Trending Articles