Convert.ToInt32(); Method in C#
This strategy is utilized to converts the specified data type to an equivalent 32-bit signed integer. So let's see the example which demonstrates Convert.ToInt32();method as shown below.
Program
using System;
namespace ToInt32_program
{
class program
{
static void Main(string[] args)
{
double f=1234567890.054565;
/* converting double to specified int */
int value = Convert.ToInt32(f);
/* Display the converted float value */
Console.Write("float value= "+f+"\nConverted to Int_32_bit={0} ", value,f);
Console.ReadKey();
}
}
}
Output
This strategy is utilized to converts the specified data type to an equivalent 32-bit signed integer. So let's see the example which demonstrates Convert.ToInt32();method as shown below.
Program
using System;
namespace ToInt32_program
{
class program
{
static void Main(string[] args)
{
double f=1234567890.054565;
/* converting double to specified int */
int value = Convert.ToInt32(f);
/* Display the converted float value */
Console.Write("float value= "+f+"\nConverted to Int_32_bit={0} ", value,f);
Console.ReadKey();
}
}
}
Output