DecimalHelper Class
Namespace: PTS
Assembly: PTSframework.dll
Provides a set of static methods for decimal type.
Syntax
public static class DecimalHelper
Inheritance
Methods
Absolute(Decimal)
Gets absolute value of a decimal number.
Declaration
public static decimal Absolute(this decimal value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Decimal | value | The number to get the absolute value of. |
Returns
| Type | Description |
|---|---|
| System.Decimal | Positive |
Remarks
This method produces the same output as native Math.Abs method.
Negative(Decimal)
Gets negative value of a decimal number.
Declaration
public static decimal Negative(this decimal value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Decimal | value | The number to get the negative value of. |
Returns
| Type | Description |
|---|---|
| System.Decimal | A |
Remarks
This method performs simple arithmetic operation x = value * -1.
ToDecimalString(Decimal, Int32)
Converts the decimal number to its string equivalent with specified number of decimal positions.
Declaration
public static string ToDecimalString(this decimal value, int precision = 2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Decimal | value | The number to converto to string. |
| System.Int32 | precision | Number of decimal positions to round the number to. |
Returns
| Type | Description |
|---|---|
| System.String | A |
ToPercentageString(Decimal)
Converts the decimal number to percentage string expression.
Declaration
public static string ToPercentageString(this decimal value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Decimal | value | The number to get the percentage expression for. |
Returns
| Type | Description |
|---|---|
| System.String | A |