Generics Vs Object in C# clarification
<p>I tried to create class with similar implementation.
One using boxing/unboxing at constructor, while other using Generics.</p>

<p>Then tried to create the object for both class 1,000,000 times.
when i run the 'for loop' for Obj class first i am always getting longer time for Obj creation, But when i run the 'for loop' for Gen class first 75% times i am getting longer time for Obj. Please help me why this behavior.
Here is the code:-</p>

<pre><code>    class Obj
{
    public string _t;
    public int _u;

    public Obj(Object t, Object u) //Boxing taking place implicitly
    {
        _t = (string)t; 
        _u = (int)u; //unboxing
    }
}
class Gen&lt;T, U&gt; 
{
    public T _t;
    public U _u;

    public Gen(T t, U u)
    {
        _t = t;
        _u = u;
    }
}
static void Main(string[] args)
    {
        long before_Obj = DateTime.Now.Ticks;
        for (int i = 0; i &lt; 1000000; i++)
        {
            new Obj("hi", i);
        }
        long after_Obj = DateTime.Now.Ticks - before_Obj;
        Console.WriteLine(after_Obj);

        long before_Gen = DateTime.Now.Ticks;
        for (int i = 0; i &lt; 1000000; i++)
        {
            new Gen&lt;string, int&gt;("hi", i);
        }
        long after_Gen = DateTime.Now.Ticks - before_Gen;
        Console.WriteLine(after_Gen);
    }
</code></pre>

<p>OUTPUT: 
2656250
1406250</p>
