-
Notifications
You must be signed in to change notification settings - Fork 139
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
New TrySet and TryGet methods? #66
Comments
the implementation shown only works for one of the concrete implementations - it fails for the most common cases; in reality, it is quite a bit more complex than this. It may be worth doing, but... I wonder whether some kind of |
@mgravell , Let me give you some context:
Again, this is probably very specific to my project, but it could be useful in similar scenarios. Kind of the same way we have throwing\nonthrowing methods equivalents in .NET framework, like |
Hi,
Currently if you try to set a value for a nonexistent property, an ArgumentOutOfRange exception is thrown.
In some scenarios it would be beneficial to have TrySet (and TryGet correspondingly) method, which will return true/false instead of throwing.
Based on indexer code, it's quite straightforward (well, possible) to implement:
I can submit a PR, just want to make sure I am not missing anything and adding these methods is okay.
The text was updated successfully, but these errors were encountered: