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
Post a Comment