Alex Rivera | Logout

Why calling some functions of the Object class, on a primitive type instance, need boxing?

Asked 2010-02-01T19:14:13.110
10

I have discovered that if i run following lines of code.

int i = 7;
i.GetHashCode(); //where GetHashCode() is the derived
                 //function from System.Object

No boxing is done, but if i call i.GetType() (another derived function from System.Object) in place of GetHashCode(), a boxing will be required to call GetType(), Why its not possible to call GetType() on primitive type instance directly, without boxing, while its possible to call GetHashCode() without boxing ?

Edit
Report

1 Answer

1
answered 2010-02-01T19:36:39.960

Your Answer