views:

142

answers:

3

Hi,

I need to convert int32 to int in VS2008 C++ CLI?

How is this done?

+1  A: 
int value = (int) int32value;
Delan Azabani
thanks mate....
JackMcLocklan
+2  A: 

Just use a cast:

int32 a = ...;
int b = (int) a;

Note that in principle this might lead to problems if you're running on a platform where int is less than 32 bits, but that's unlikely if it's a program for Windows.

Jesper
thanks mate....
JackMcLocklan
+2  A: 

The C++/CLI keyword int is an alias for System.Int32. No conversion or casting is necessary.

Ben Voigt
This is preferable to a cast as the compiler should complain at you it anything ever changes.
LukeN