Values, validation, and utilities
Numeric input
InvariantNumberParser.TryParse has overloads for double, int, and uint, including minimum and maximum bounds. Check ValidationResult.IsSuccess before using the output value.
The parser accepts decimal input independently of the current numeric culture and supports multipliers such as k for thousands and M for millions. This is user-input parsing; use the matching Asv.IO serialization APIs for protocol fields.
ValidationResult distinguishes success from failures such as empty input, invalid characters, a non-number, or an out-of-range value. LocalizedException retains a technical Message and an optional LocalizedMessage. Display the localized message when present and fall back to the technical message.
Time
ITimeService.Now supplies wall-clock DateTime values to the time-based collections. DefaultTimeService uses DateTime.Now; SetCorrection is not implemented there. CorrectedTimeService provides a separate implementation for corrected time.
Other helpers, including IncrementalRateCounter, accept a .NET TimeProvider. Inject a controllable provider in tests instead of relying on delays. Keep the timestamp convention of stored data consistent with the time service used to expire it.
Identifiers and display names
ShortGuid offers a compact GUID representation. SemVersion handles semantic-version values. These have different purposes from WordFingerprint, which creates a localized three-word display phrase.
A fingerprint is a display aid, not a unique identifier or security checksum. Preserve the original GUID or input alongside it. Pass a culture explicitly when a display phrase must be reproducible independently of CurrentUICulture.
Other utilities
Area | Types |
|---|---|
Coordinates and angles |
|
Mathematics |
|
Checksums |
|
Text output |
|
Progress and rates |
|
Choose a checksum implementation that matches the protocol, including its seed and finalization rules. CRC values detect accidental corruption; they do not authenticate data.
PasswordHash preserves an existing PBKDF2-SHA1 format: iterations:base64(salt):base64(hash). Validation uses the iteration count and output length stored in that string. Treat this as a compatibility API; changing its algorithm without versioning the format would invalidate existing records.