Beispiel #1
0
 static void ProblemPrinter(int problemNumber)
 {
     var probleName = "Problem"+problemNumber;
     ProblemSolver s = new ProblemSolver();
     Type t = s.GetType();
     Stopwatch timer = new Stopwatch();
     try
     {
         var pb = t.GetMethod(probleName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
         Debug.Write("Problem " + problemNumber + " : ");
         timer.Start();
         Debug.WriteLine(pb.Invoke(s, null));
         Debug.WriteLine("elapsed time :" + timer.ElapsedMilliseconds + "ms------------------------------------\n");
         timer.Stop();
     } catch(Exception) {
         Debug.WriteLine("ERROR");
         timer.Stop();
     }
 }
Beispiel #2
0
        static void ProblemPrinter(int problemNumber)
        {
            var           probleName = "Problem" + problemNumber;
            ProblemSolver s          = new ProblemSolver();
            Type          t          = s.GetType();
            Stopwatch     timer      = new Stopwatch();

            try
            {
                var pb = t.GetMethod(probleName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
                Debug.Write("Problem " + problemNumber + " : ");
                timer.Start();
                Debug.WriteLine(pb.Invoke(s, null));
                Debug.WriteLine("elapsed time :" + timer.ElapsedMilliseconds + "ms------------------------------------\n");
                timer.Stop();
            } catch (Exception) {
                Debug.WriteLine("ERROR");
                timer.Stop();
            }
        }