c# - Why casting to object when comparing to null? -
While browsing the MSDN documentation on equal overrides, one point caught my attention.
, some blank checks are made, and the objects are executed in the system. When comparing the object type:
Public override Bull Iqbal (System.Object OBJ) {// If the parameter is Zero the details are false. If (obj == faucet) {returning back; } // If the parameter can not be inserted on the return fate, two deconents as two pointpoint P = obj If ((System.Object) p == faucet) {return false; } // Return the field match if it is correct: return (x == p.x) & amp; Amp; (Y == P.E.); }
Is there any specific reason to use this artist, or has it forgotten some "useless" code in this example?
== It is possible for a type of operator to surcharge. The cast for the object ensures that the original definition is used.
Comments
Post a Comment