GetNext() public method

public GetNext ( int a, int b, int c, int d, int e ) : int
a int
b int
c int
d int
e int
return int
Beispiel #1
0
        static void Main(string[] args)
        {
            IntRange r = new IntRange();

            long num = 9;

            num = r.GetNext(1, 2, 3, 4, 5);
            Console.WriteLine("first {0}", num);
            if(num == 1) {
                Console.WriteLine("err");
                return;
            }
            num = r.GetNext(6, 7, 8, 9, 10);
            Console.WriteLine("second {0}", num);
        }
        static void Main(string[] args)
        {
            IntRange r = new IntRange();

            long num = 9;

            num = r.GetNext(1, 2, 3, 4, 5);
            Console.WriteLine("first {0}", num);
            if (num == 1)
            {
                Console.WriteLine("err");
                return;
            }
            num = r.GetNext(6, 7, 8, 9, 10);
            Console.WriteLine("second {0}", num);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            long     min = 1, max = 1000000;
            long     tot = 0;
            DateTime t1  = DateTime.Now;

            foreach (int i in Range(min, max))
            {
                //Console.WriteLine("i={0}", i);
                tot++;
            }

            DateTime t2 = DateTime.Now;

            TimeSpan ts = t2 - t1;

            Console.WriteLine("Iteration with C# yield: {0}ms", ts.TotalMilliseconds);


            tot = 0;

            t1 = DateTime.Now;

            IntRange r = new IntRange(min, max);
            long     x;

            while ((x = r.GetNext()) != 0)
            {
                //Console.WriteLine("x={0}", x);
                tot++;
            }

            t2 = DateTime.Now;

            ts = t2 - t1;

            Console.WriteLine("Iteration with continuations: {0}ms", ts.TotalMilliseconds);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            long min = 1, max = 1000000;
            long tot = 0;
            DateTime t1 = DateTime.Now;

            foreach (int i in Range(min, max))
            {
                //Console.WriteLine("i={0}", i);
                tot++;
            }

            DateTime t2 = DateTime.Now;

            TimeSpan ts = t2 - t1;

            Console.WriteLine("Iteration with C# yield: {0}ms", ts.TotalMilliseconds);

            tot = 0;

            t1 = DateTime.Now;

            IntRange r = new IntRange(min, max);
            long x;

            while((x = r.GetNext()) != 0)
            {
                //Console.WriteLine("x={0}", x);
                tot++;
            }

            t2 = DateTime.Now;

            ts = t2 - t1;

            Console.WriteLine("Iteration with continuations: {0}ms", ts.TotalMilliseconds);
        }