Decimal.Zero
is a C# Decimal
field that represents the number zero (0).
public static readonly decimal Zero;
It takes no parameters and is only invoked on the decimal
.
The value returned is a zero (0).
// use Systemusing System;// create classclass DecimalZero{// main methodstatic void Main(){// print the fieldConsole.WriteLine(Decimal.Zero);// perform arithmetic operationsdecimal d1 = 3.44m + Decimal.Zero;decimal d2 = Decimal.Zero + 4.23m;decimal d3 = Decimal.Zero - Decimal.Zero;// print valuesConsole.WriteLine(d1);Console.WriteLine(d2);Console.WriteLine(d3);}}
Decimal.Zero
field.Decimal.Zero
field. We then store the results on some decimal variables d1
, d2
, and d3
.