Casting oblivious nullable type to nullable and dereferencing does not report warning #2575
Answered
by
YairHalberstadt
duracellko
asked this question in
General
-
When a method returns oblivious nullable type and it is assigned to explicitly nullable variable, compiler still does not report warning, when dereferencing the variable. More details in sample repository https://github.com/duracellko/CS8Nullable. |
Beta Was this translation helpful? Give feedback.
Answered by
YairHalberstadt
Oct 28, 2020
Replies: 2 comments
-
This is by design. The type a variable is assigned to does not affect its nullable flow state. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YairHalberstadt
-
If you do an explicit cast, then there is a warning reported. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is by design. The type a variable is assigned to does not affect its nullable flow state.