Skip to content

ToDictionary TKey nullable check #4608

Answered by dstarkowski
IgorMenshikov asked this question in Q&A
Discussion options

You must be logged in to vote

Either declare Name in Entity class as non nullable, or use ! to tell compiler i.Name is not null.

var periodHash = context.Query<Entity>()
    .Where(i => i.Name != null)
    .ToDictionary(i => i.Name!, i => i);

Also see #3951

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@IgorMenshikov
Comment options

@FaustVX
Comment options

@IgorMenshikov
Comment options

@Joe4evr
Comment options

Answer selected by 333fred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants