
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Decimal to Int64 (long) in C#
Use the Convert.ToInt64() method to convert Decimal to Int64 (long) in C#.
Let’s say we have a decimal variable.
decimal d = 310.23m;
Now to convert it to Int64, use the Convert.ToInt64() method.
long res; res = Convert.ToInt64(d);
Let us see another example −
Example
using System; class Demo { static void Main() { decimal d = 190.66m; long res; res = Convert.ToInt64(d); Console.WriteLine("Converted Decimal '{0}' to Int64 value {1}", d, res); } }
Output
Converted Decimal '190.66' to Int64 value 191
Advertisements