NumericExtensions¶
Numeric string testing and decimal precision helpers. (BR-079) through BR-081
Purpose¶
Context¶
- Namespace:
SAIF.Common.Extensions - Assembly/package:
SAIF.Framework.Common
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| IsNumeric(this string value) | public static bool IsNumeric(this string value) |
Tests via int.TryParse; bounded to int range, so a decimal value or one exceeding Int32.MaxValue reports false. (BR-079) |
| Precision(this decimal value) | public static int Precision(this decimal value) |
Reads the scale byte via BitConverter.GetBytes(decimal.GetBits(decimalValue)[3])[2] to return the declared decimal-place count. (BR-080) |
| TruncatePrecision(this decimal value, int precision) | public static decimal TruncatePrecision(this decimal value, int precision) |
Truncates (does not round) value to precision decimal places. (BR-081) |
Sources¶
Common/SAIF.Common/Extensions/NumericExtensions.cs