- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert.ToInt32 Method in C#
Use the Convert.ToInt32() method to convert a specified value to a 32-bit signed integer.
Let us take a double variable.
double doubleNum = 11.53;
Now, we will convert it to Int32 using the Convert.ToInt32 method.
int intNum; ntNum = Convert.ToInt32(doubleNum);
Example
using System; public class Demo { public static void Main() { double doubleNum = 11.53; int intNum; intNum = Convert.ToInt32(doubleNum); Console.WriteLine("Converted {0} to {1}", doubleNum, intNum); } }
Output
Converted 11.53 to 12
Advertisements