specific class variable value in generic method
<p>in my program I have following code:</p>

<pre><code> private void SetCorners&lt;T&gt;(T position, int width, int height)
    {
        float halfWidth = width / 2 + position.X;
        float halfHeight = height / 2 + position.Y;

        UpperLeft = new Vector2(-halfWidth, -halfHeight);
        UpperRight = new Vector2(halfWidth, -halfHeight);
        LowerLeft = new Vector2(-halfWidth, halfHeight);
        LowerRight = new Vector2(halfWidth, halfHeight);
    }
</code></pre>

<p>In which T is either <code>Vector2</code> or <code>Vector3</code> from <code>Microsoft.Xna.Framework</code>. This code does not build because <code>T</code> does not contains definition of them.How to make this method works? </p>
