I recently received the following Visual Studio warning in code similar to the image:
Iunderstandwhathewantedtotellme:thereisareferencecomparisonofthetwovalues(ofthesessionandofthe"test" string), and this will always return false
, since any value stored in Session
will never be referenced in the right-hand string.
But why does this happen? Why Visual Studio was not able to do the comparison without a previous conversion?
PS: The same happens with ViewState