http://manoli.net/csharpformat/ ここによるC#コードのHTML化。
1: using System;
2: using System.Collections.Generic;
3: using System.Text;
4: using System.Collections;
5:
6: namespace IteratorSample
7: {
8: class Program
9: {
10: public static IEnumerable WeekDays(int days) {
11: DateTime dt = DateTime.Today;
12: for (int i = 1; i <= days;) {
13: if (dt.DayOfWeek != DayOfWeek.Sunday && dt.DayOfWeek != DayOfWeek.Saturday) {
14: yield return dt;
15: i++;
16: }
17: dt = dt.AddDays(1);
18: }
19: }
20:
21: static void Main(string[] args) {
22: foreach (DateTime dt in WeekDays(10)) {
23: Console.WriteLine(dt.ToString("yyyy年MM月dd日(ddd)"));
24: }
25: }
26: }
コメント
ちょっとフォントが小さいかなぁ。