-
-
Couldn't load subscription status.
- Fork 19
feat: add Try-prefixed methods #17
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
base: main
Are you sure you want to change the base?
Conversation
|
This should also include the extension variant of the methods, which is where it tends to be used. |
|
Thank you for the response. |
|
Thanks for the pull request! Is the primary goal to have versions of those methods that don't ever throw? I notice that the new extraction plan now uses a class's Does anyone know if there are any common types where |
|
A regex-matching text could throw any exception when parsing, e.g. If we are talking about the C# system types, all of those having |
|
I would say to maintain compatibility with user-defined types that use a Parse(string) method, it can look for a TryParse method, and then fallback to the Parse method if one is not found. |
|
Thanks for pointing this out. I'll implement an attempt to |
|
@duydang2311, I converted this to a Draft PR for now. Please mark it as |
Once .NET 7 is available it can also check to see if the type is |
119c99a to
18f8b62
Compare
This PR adds Try-prefixed methods, including:
TryConstruct,TryExecute,TryExtract.