Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

CA1065 & CA1062 conflict

$
0
0

This member gets a CA1062 if I don't test the obj param and a CA1065 (or CA2201) if I do.

Is there a way to code this such that no warnings are issued?
Returning an actual value on null is inappropriate (it really should throw). 
Suppressing the 1062 seems most appropriate to me so far but other opinions are welcome.

public static implicit operator Int32(Int32Wrapper<T> obj)
{
    // if (obj == null) throw new ArgumentNullException("obj");
    // if (obj == null) throw new NullReferenceException();
    return obj.Value;
}


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>