コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("please input your number");
            var userInput = Console.ReadLine();

            try
            {
                for (int i = 0; i < userInput.Length; i++)
                {
                    var c = userInput[i];
                    CheckCharFun = null;
                    var type = GetCharType(c);
                    if (CheckCharFun.Invoke(c, i))
                    {
                        CheckedTypes.Add(type);
                    }
                    else
                    {
                        throw new Exception("not a valid number");
                    }
                }
                Console.WriteLine("success");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.Read();
        }