Author: you've been HAACKED | Posted on: 7/14/2009 10:48:29 AM | Views : 999

Recently I read a discussion on an internal mailing list on whether or not it would be worthwhile to add a null dereferencing operator to C#. For example, one proposed idea would allow the following expression. object a = foo.?bar.?baz.?qux; This would assign the variable a the value null if any one of foo, bar , or baz is null instead of throwing a NullReferenceException . It?s a small, but potentially helpful, mitigation for the billion dollar mistake . Sure enough, it did not take long for someone to claim that this syntax would be unnecessary if the code here was not violating the sacred Law of Demeter (or LoD for short). I think this phenomena is an analog to Godwin?s Law and deserves its own name. Let?s call it the ?LoD Dot Counting Law...(read more) ...

Go to the complete details ...