c# - How to set up MS Visual Studio to warn me about class instance comparison with operator ==? -


regular condition looks this:

if (number == 5) ... 

but if comparing class instances need use equals method. let's have instances a, b of class, this:

if (a.equals(b)) ... 

what need set visual studio 2015 warn/error me if this:

if (a == b) 

in other words if use equal operator class instances.

thanks lot.

hard way create custom rule here bit difficult.

the easy way use resharper , create custom rule commercial tool.

another thing overloading == operator in every class throws exception, works if using own classes , bit tiresome.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -