- 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
C# Program to convert a Double value to an Int64 value
To convert a Double value to an Int64 value, use the Convert.ToInt64() method.
Int64 represents a 64-bit signed integer.
Let’s say the following is our double value.
double val = 23.951213e12;
Now to convert it to Int64.
long longVal = Convert.ToInt64(val);
Let us see the complete example.
Example
using System; public class Demo { public static void Main() { double val = 23.951213e12; long longVal = Convert.ToInt64(val); Console.WriteLine("Converted double {0:E} to Int64 {1:N0} value ", val, longVal); } }
Output
Converted double 2.395121E+013 to Int64 23,951,213,000,000 value
Advertisements