Skip to content

C8602 nullability warning after comparing not null member to null #8399

Answered by jnm2
joshudson asked this question in General
Discussion options

You must be logged in to vote

You can do this by applying [MemberNotNull(nameof(logins))] to the InitLogins method. Then the compiler will not warn in your sample, and it will check that logins is indeed not null for each return point within InitLogins.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by joshudson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants