クイズ

http://blogs.msdn.com/brada/archive/2004/10/26/248324.aspx
またしても、Brad Abrams氏のところから。で、自分なりの回答。

using System;
using System.Collections.Generic;

class Program
{
    static void Main(string args)
    {
        string inputValues = { 
            "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "bad value"};

        int[] outputValues = Array.ConvertAll(inputValues, new Converter<string, int>(
            delegate(string s) { 
                int n;
                if (Int32.TryParse(s, out n))
                {
                    if *1;
        Console.Read();
    }
}

前回の反則回答よりは・・・(^^;

(追記) 奇数は赤で表示するのが抜けてました。問題読んでないなぁ・・・

*1:n & 1) != 0) Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(n); Console.ResetColor(); } return n; }