I would suggest that this is because you are testing for equality of objects, not for equality of strings.
That is, in the first example, the compiler made the repository text1 and text2 the actual same object, since the contents are the same. In the second example, new objects are returned by calling ToLower () and, therefore, are no longer the same object.
If you change the declared storage type from an object to a string, you will see the desired behavior.
cyborg
source share