Replies: 1 comment 2 replies
-
Do you have an example of "unpredictable effects" of an A simple example where public bool TryConvertToInt(object originalValue, out int intValue)
=> originalValue is int into intValue || (originalValue is string str && int.TryParse(str, out intValue)); Maybe I am missing something, but right now I would do it the following way: public bool TryConvertToInt(object originalValue, out int intValue)
{
if (originalValue is int iv)
{
intValue = iv;
return true;
}
return originalValue is string str && int.TryParse(str, out intValue);
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-09-15.md
Agenda:
Beta Was this translation helpful? Give feedback.
All reactions