Calculate the number of working days between two dates based on the company's project requirements, and write a method to handle the problem, as shown below:
1 using system;
2 using system. Collections. Generic;
3 using system. text;
4
5 namespace leleapplication1
6 {
7 class Program
8 {
9 static void main (string [] ARGs)
10 {
11 datetime dt1 = new datetime (2007, 06, 14 );
12 datetime dt2 = datetime. now;
13
14 timespan ts1 = dt2.subtract (dt1 );
15 int countday = ts1.days; // calendar days
16 int weekday = 0; // workday
17 For (INT I = 0; I <countday; I ++)
18 {
19 datetime tempdt = dt1.date. adddays (I );
20 if (tempdt. dayofweek! = System. dayofweek. Saturday & tempdt. dayofweek! = System. dayofweek. Sunday)
21 {
22 weekday ++;
23}
24}
25 console. writeline ("natural days" + countday. tostring ());
26 console. writeline ("workday" + weekday. tostring ());
27 console. Readline ();
28}
29}
30}
31