Nullable type warnings

I'm seeing what I think is odd behavior related to nullable types in
ReSharper 4.0, so I created some test cases to try to demonstrate (as well
as to hopefully clear some of my own confusion):

int? value = 0;
int? nullable = null;

Assert.That(value is ValueType, Is.True);
Assert.That(nullable is ValueType, Is.False);

In these two tests, ReSharper 4.0 warns, "The given expression is always of
the provided type. Consider comparing with 'null' instead." According to
what I'm seeing in the unit tests, this is not true. When a nullable type
contains a value, the expression is of the provided type; however, when the
value is null the expression is no longer true... unless I'm just confused
and someone can clarify.

Please sign in to leave a comment.