Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement IParsable<T> #268

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Implement IParsable<T> #268

merged 1 commit into from
Jun 5, 2024

Conversation

mburumaxwell
Copy link
Contributor

IParsable<T> is useful for generic parsing. This PR adds support for it on ByteSize, Duration, Etag, Ksuid, Money, and SwiftCode.

Consequently:

  1. Creating Etag from string has been marked as obsolete in favour of parsing.
  2. Parsing of Money requires more explict currency specification where the symbol is used by multiple currencies, such as $ which is used by 9 currencies. Money.Parse(...) will throw but Money.TryParse(...) will return false.

`IParsable<T>` is useful for generic parsing. This PR adds support for it on `ByteSize`, `Duration`, `Etag`, `Ksuid`, `Money`, and `SwiftCode`.

Consequently:
1. Creating `Etag` from string has been marked as obsolete in favour of parsing.
2. Parsing of `Money` requires more explict currency specification where the symbol is used by multiple currencies, such as `$` which is used by 9 currencies. `Money.Parse(...)` will throw but `Money.TryParse(...)` will return false.
@mburumaxwell mburumaxwell merged commit 2e8832f into main Jun 5, 2024
8 checks passed
@mburumaxwell mburumaxwell deleted the IParsable branch June 5, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant