Provides a relatively "safe" interchange between decimal and string notations for numbers, inspecting the input string to try to make the best decision based on the contents of the string instead of just relying on the current thread culture (which causes issues when communicating between machines with different ideas of what constitutes "correct" decimal notation a prime example being transport of decimals from Javascript into a ZA .net culture – but there are others)
More...
|
| DecimalDecorator (decimal value, string format=null) |
| Constructs a new DecimalDecorator with the provided decimal value an an optional string format.
|
| DecimalDecorator (string value) |
| Constructs a new DecimalDecorator with the provided string value to parse as a decimal.
|
override string | ToString () |
decimal | ToDecimal () |
| Returns the decimal version of the underlying data.
|
|
static decimal | Parse (string value) |
| Attempts to do a direct parse on a string value.
|
|
bool | IsValidDecimal [get] |
| Flag: is the underlying value a valid decimal value.
|
Provides a relatively "safe" interchange between decimal and string notations for numbers, inspecting the input string to try to make the best decision based on the contents of the string instead of just relying on the current thread culture (which causes issues when communicating between machines with different ideas of what constitutes "correct" decimal notation a prime example being transport of decimals from Javascript into a ZA .net culture – but there are others)
◆ DecimalDecorator() [1/2]
PeanutButter.Utils.DecimalDecorator.DecimalDecorator |
( |
decimal | value, |
|
|
string | format = null ) |
Constructs a new DecimalDecorator with the provided decimal value an an optional string format.
- Parameters
-
value | Decimal value to decorate |
format | Optional string format to use |
◆ DecimalDecorator() [2/2]
PeanutButter.Utils.DecimalDecorator.DecimalDecorator |
( |
string | value | ) |
|
Constructs a new DecimalDecorator with the provided string value to parse as a decimal.
- Parameters
-
value | String value to parse as Decimal |
◆ Parse()
decimal PeanutButter.Utils.DecimalDecorator.Parse |
( |
string | value | ) |
|
|
static |
Attempts to do a direct parse on a string value.
- will break if the input value is clearly not a decimal, eg "aaa"
- Parameters
-
- Returns
◆ ToDecimal()
decimal PeanutButter.Utils.DecimalDecorator.ToDecimal |
( |
| ) |
|
Returns the decimal version of the underlying data.
- Returns
- The decimal version of the underlying data
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/DecimalDecorator.cs