
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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
- Related Articles
- Convert long primitive to Long object in Java
- C# Program to convert a Double value to an Int64 value
- Convert Decimal to Binary in Java
- Convert String to Long in Java
- How to convert Long array list to long array in Java?
- Convert decimal integer to octal in Java
- How to Convert Binary to Decimal?
- How to Convert Decimal to Binary?
- How to Convert Decimal to Octal?
- How to Convert Decimal to Hexadecimal?
- How to Convert Hexadecimal to Decimal?
- Convert from String to long in Java
- How to convert Decimal to Binary in JavaScript?
- How to convert Binary to Decimal in JavaScript?
- How to convert Decimal to Hexadecimal in Java

Advertisements