In the general GetHashCode(T foo) method, I check if foo null . However, I just stumbled upon Reshar's strange warning.
In the following code, can foo never be null ?
private class FooComparer<T> : IEqualityComparer<T> where T: Foo { public int GetHashCode(T foo) {
However, as far as I can tell, itβs completely legal:
Foo foo = null; var fooComparer = new FooComparer<Foo>(); int hash = fooComparer.GetHashCode(foo);
source share