|
Listing 7-20 extracted from chapter Reflection, late binding, attributes
Listing 7-19< > Listing 7-21
This listing can be compiled with the command line: csc.exe /target:exe Example_7_20.cs Errors: 0 Warnings: 0
Example_7_20.cs
using System;
using System.Diagnostics;
class Program {
static int Eval( int x ) {
return 30139-x*(13735-x*(83+x*66));
}
static void Main() {
Stopwatch sw = Stopwatch.StartNew();
for( int x = -26 ; x<= 19 ; x++ )
for( int i = 0 ; i<10000000 ; i++)
Eval(x);
Console.WriteLine("Duration:" + sw.Elapsed );
}
}
Copyright Patrick Smacchia 2006 2007
|