I have trouble doing this. I\'m creating a method that add working days on a specific date. for example, I want to add 3 working days to sept 15, 2010 (Wednesday), the method wo
A cool way (i think) is put that in a extension method, like:
public static class DateTimeExtensions
{
public static DateTime AddWorkingDays(this DateTime self, int days)
{
self = self.AddDays(days);
while (self.DayOfWeek == DayOfWeek.Saturday || self.DayOfWeek == DayOfWeek.Sunday)
{
self = self.AddDays(1);
}
return self;
}
}
so your final code will look like:
specificDate.AddWorkingDays(3);