Returns the absolute value of the specified decimal .
[Edit]
Parameters
- value
- A decimal.
[Edit]
Returns
A decimal containing the absolute value of value.
[Edit]
Remarks
Example
The following example demonstrates the Math.Abs(sbyte)(decimal) method.
C# Example |
using System;
public class MathAbsExample
{
public static void Main()
{
Decimal d1 = Math.Abs( (Decimal)0.00 );
Decimal d2 = Math.Abs( (Decimal)(-1.23) );
Console.WriteLine("Math.Abs( (Decimal)0.00 ) returns {0}",d1);
Console.WriteLine("Math.Abs( (Decimal)(-1.23) ) returns {0}",d2);
}
}
|
The output is
Math.Abs( (Decimal)0.00 ) returns 0
Math.Abs( (Decimal)(-1.23) ) returns 1.23
Requirements
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0