Decimal.FromOACurrency() Method in C#


The Decimal.FromOACurrency() method in C# is used to convert the specified 64-bit signed integer, which contains an OLE Automation Currency value, to the equivalent Decimal value

Syntax

Following is the syntax −

public static decimal FromOACurrency (long val);

Above, Val is an OLE Automation Currency value.

Example

Let us now see an example to implement the Decimal.FromOACurrency() method −

using System;
public class Demo {
   public static void Main(){
      long val = 978576L;
      decimal res = Decimal.FromOACurrency(val);
      Console.WriteLine("Decimal Value = "+ res);
   }
}

Output

This will produce the following output −

Decimal Value = 97.8576

Example

Let us now see another example to implement the Decimal.FromOACurrency() method −

using System;
public class Demo {
   public static void Main(){
      long val = long.MinValue;
      decimal res = Decimal.FromOACurrency(val);
      Console.WriteLine("Decimal Value = "+ res);
   }
}

Output

This will produce the following output −

Decimal Value = -922337203685477.5808

Updated on: 11-Nov-2019

28 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements