ToDictionary TKey nullable check #4608
Answered
by
dstarkowski
IgorMenshikov
asked this question in
Q&A
-
|
I have a linq query var periodHash = context.Query<Entity>()
.Where(i => i.Name != null)
.ToDictionary(i => i.Name, i => i);So, I can be sure key cannot be null. But I get a warning: Is there a way to avoid the warning? |
Beta Was this translation helpful? Give feedback.
Answered by
dstarkowski
Mar 31, 2021
Replies: 1 comment 4 replies
-
|
Either declare Also see #3951 |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
333fred
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either declare
NameinEntityclass as non nullable, or use!to tell compileri.Nameis not null.Also see #3951