I noticed that I get an unexpected result when I execute this:
object v1 = "Hallo";
object v2 = "Hallo";
char[] v3 = { 'H', 'a', 'l', 'l', 'o' };
object v4 = new string(v3);
bool resultOfTwoObjectsThatAreActuallyStrings = v1 == v2;
bool anotherResultOfTwoObjectsThatAreAlsoStrings = v1 == v4;
Console.WriteLine("First result: " + resultOfTwoObjectsThatAreActuallyStrings);
Console.WriteLine("Second result: " + anotherResultOfTwoObjectsThatAreAlsoStrings);
I would expect that I am doing exactly the same thing for both variables, but I get one time false and one time true.
Can anyone explain this to me?