c# - StructuralComparisons for arrays -


in f#:

[0] = [0] = true 

in c# or .net bcl in general:

structuralcomparisons.equals(new int[] { 0 }, new int[] { 0 }) == false 

why?


postscript:

the reason thought had "right" equals because turned out true:

var = new { x = 3, y = new { z = -1 } }; var b = new { x = 3, y = new { z = -1 } };  structuralcomparisons.equals(a, b) == true; 

that's because you're going down object.equals(obja, objb) won't able handle kind of comparison.

instead this:

structuralcomparisons.structuralequalitycomparer.equals(..., ...) 

Comments

Popular posts from this blog

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -