views:

42

answers:

2

I was wondering if there is a good reason for ScriptReference not to override Equals. It would certainly make life in ScriptReferenceCollections easier (e.g. Contains), would it not?

A: 

My guess is either the framework team forgot, which is unlikely but could occur. Or they just didn't see a need, normally with reference objects you don't override the Equals method unless you are using some kind of entity object that is expected to compare across different references, such as a string or a Uri. Granted it would have been easy to implement this because it only takes two values. So to be honest, I don't know why.

Nick Berardi
+1  A: 

It has too many properties that may vary to make it viable to use some form of value based equality.

Note also it isn't sealed hence its sub-types may introduce further properties which would invalidate any existing equality code and hence make equality testing even more complex.

AnthonyWJones