C# Decimal Add
Description
Decimal Add
adds two specified Decimal values.
Syntax
Decimal.Add
has the following syntax.
public static decimal Add(
decimal d1,
decimal d2
)
Parameters
Decimal.Add
has the following parameters.
d1
- The first value to add.d2
- The second value to add.
Returns
Decimal.Add
method returns The sum of d1 and d2.
Example
The following code sample illustrates the use of Add :
using System;//from w w w .j ava 2 s . c om
class MyClass{
public void Main() {
decimal MyFortune;
MyFortune = Decimal.Add(12M, .01m);
System.Console.WriteLine(MyFortune.ToString("C"));
}
}
The code above generates the following result.