'Why false != false? [duplicate]

I have a method that check if 2 arguments are equal:

using System;

class Program{
    static void Main(string[] args){
        CheckEquality(false, false);
        Console.ReadKey();
    }
    public static void CheckEquality(object a, object b)
    {
        if (a == b){
            Console.WriteLine("yes");
        }else{
            Console.WriteLine("no");
        }
    }
}

As you can see, 2 arguments are "false", but when I run the program, the console says:

no


Solution 1:[1]

You're actually not comparing values here.

You are comparing references. In this case references to object containing bool values.

So while the values inside the objects might be the same, the equals (==) operator for the object only compares the references, not the values. Since you have two distinct boxes the references are different, hence the result is false.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 geertjanknapen