Mono Class Library: System.Math Overview | Members

System.Math.Abs Method

Returns the absolute value of the specified decimal . [Edit]

public static decimal Abs (decimal value)

Parameters

value
A decimal. [Edit]

Returns

A decimal containing the absolute value of value. [Edit]

Remarks

Documentation for this section has not yet been entered. [Edit]

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