class ClassTest
{
public virtual void m1() { }
}
struct StructTest
{
public void m1() { }
}
class Program
{
static void Main(string[] args)
{
DateTime dtStart = DateTime.Now;
ClassTest t1 = new ClassTest();
for (int i = 0; i < 200000000; i++)
{
t1.m1();
}
Console.WriteLine("class invoke time " + (DateTime.Now - dtStart).TotalMilliseconds);
dtStart = DateTime.Now;
StructTest t2 = new StructTest();
for (int i = 0; i < 200000000; i++)
{
t2.m1();
}
Console.WriteLine("struct invoke time " + (DateTime.Now - dtStart).TotalMilliseconds);
}
}