In the case of structure, like the integer used here, there will be no difference. For classes maybe.
For structures like int, bool, datetime, etc. the internal value is compared with ==, not a reference. for classes == compares the reference, but equals can be overridden to apply custom comparison. for example, if the class Foo is a class that contains a primary key and overrides its basic implementation equivalent for comparing keys:
var foo1 = new Foo{PrimaryKey = 5}; var foo2 = new Foo{PrimaryKey = 5}; foo1 == foo2
source share