Use Convert.ToInt32
from mscorlib
as in
decimal value = 3.14m;
int n = Convert.ToInt32(value);
See MSDN. You can also use Decimal.ToInt32
. Again, see MSDN. Finally, you can do a direct cast as in
decimal value = 3.14m;
int n = (int) value;
which uses the explicit cast operator. See MSDN.