Coffeehouse Post

Single Post Permalink

View Thread: What is the worst thing in .NET?
  • User profile image
    Eric Falsken

    littleguru wrote:
    Klaus Enevoldsen wrote:
    What about ".Equals(object) : boolean"? It is seriously the worst thing in the .NET Framework. It was only invented because we did not have operator overloading in .NET 1.0! Removing "Equals" from the framework would be an OK breaking change!

    Please not! I need Equals:

    int i = 1;
    int j = 1;
    object o1 = i;
    object o2 = j;

    bool r1 = (o1 == o2); // false
    bool r2 = o1.Equals(o2); // true

    how about:

    bool r1 = (o1 == o2); //true
    bool r2 = (o1 === o2); //false

    That would be much better imho. Just like PHP. use === for identity equality, == for value equality, and = for assignment. Very standard and clear.