[NotNull] Annotation for collection items

In most cases my collections never have null elements. So when iterating over them (either with "foreach" or with LINQ queries) Resharper displays to many false positives.

It would be nice to have a special annotation for collections to say that all items can never be null.

The best example for it is the Dictionary<K,V>.Keys collection. A key in the dictionary can never be null, but the ReSharper doesn't know it.

Is there a way to extend or improve the analysis engine?

Michael Damatov
prodot GmbH

1 comment
Comment actions Permalink

There is [ItemNotNull] but it doesn't work for Dictionary.

https://youtrack.jetbrains.com/issue/RSRP-463007

0

Please sign in to leave a comment.