Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Decimal.ToOACurrency() Method in C#
The Decimal.ToOACurrency() method in C# is used to convert the specified Decimal value to the equivalent OLE Automation Currency value, which is contained in a 64-bit signed integer.
Syntax
Following is the syntax −
public static long ToOACurrency (decimal val);
Above, Val is the decimal number to convert.
Example
Let us now see an example to implement the Decimal.ToOACurrency() method −
using System;
public class Demo {
public static void Main(){
Decimal val = 95;
Console.WriteLine("Decimal value = "+val);
long res = Decimal.ToOACurrency(val);
Console.WriteLine("Long value = "+res);
}
}
Output
This will produce the following output −
Decimal value = 95 Long value = 950000
Example
Let us now see another example to implement the Decimal.ToOACurrency() method −
using System;
public class Demo {
public static void Main(){
Decimal val = 9587.567m;
Console.WriteLine("Decimal value = "+val);
long res = Decimal.ToOACurrency(val);
Console.WriteLine("Long value = "+res);
}
}
Output
This will produce the following output −
Decimal value = 9587.567 Long value = 95875670
Advertisements
