C# Decimal Subtract

Description

Decimal Subtract subtracts one specified Decimal value from another.

Syntax

Decimal.Subtract has the following syntax.


public static decimal Subtract(
  decimal d1,
  decimal d2
)

Parameters

Decimal.Subtract has the following parameters.

  • d1 - The minuend.
  • d2 - The subtrahend.

Returns

Decimal.Subtract method returns The result of subtracting d2 from d1.

Example

The following example illustrates the use of Subtract.


using System;//from w  ww.ja  v a 2s  .c  o m
class MainClass {
  public static void Main(){
     System.Console.WriteLine(Decimal.Subtract(1.2M, 1.1M));
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version