Possible Duplicate:
C#, int or Int32? Should I care?
I'm using GetPosition(this) when MouseMoved event gets triggered so having:
Point pt = e.GetPosition(this);
As far as I see both following type casts work but which one is recommended and why?
int x = (int)pt.X;
int x = (Int32)pt.X;
They do exactly the same thing - they'll even compile to the same IL. (Assuming you haven't got some crazy other Int32 type somewhere...)
int is just an alias for global::System.Int32.
(This doesn't just apply to casting - it's almost anywhere that a type name is used.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With