I'm working on customizing (and fixing) a large application for a client which was purchased from another source. The code we ended up getting was most certainly NOT the actual code used in production by the source client. That being said, I ran into this today:
if (lblCurrentValueOfContractAmount.Text == "0.0")
lblCurrentValueOfContractAmount.Text = "0.0";
And no, I'm not joking. My first inclination was to just remove it, then I started talking to another developer who mentioned that there might be some clandestine stuff going on here, like somebody subscribed to the label's text being changed, etc. Honestly I'm not that concerned about it, so I'm just going to leave it in. However, this brings me to my question:
Let's assume that there is someone subscribed to TextChanged, for example. If the text doesn't actually change, would the compiler optimize that whole statement away? Would the event actually fire?
Aucun commentaire:
Enregistrer un commentaire