NotNull on container items

Is there a way to flag a container so that all of its items are assumed to be NotNull?  I end up having to do a lot of extract null checks in order to satisfy the Resharper static analysis.  For example:

foreach (var item in this.Items)
{
     Debug.Assert(item != null);
     item.Print();
}

The Debug.Assert is there just to keep Resharper from complaining about item possibly being null (could also be done with comments).  I know that Items cannot contain a null, but there doesn't seem to be a way to tell Resharper that.

Please sign in to leave a comment.