Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 12
    blogs.msdn.com/peterhal/archive/2005/07/05/435760.aspx Commented Nov 10, 2009 at 20:39
  • 2
    @RHSeeger: There was no statement in Petter Hallam's blog post that can be construed as "people are too stupid to understand the concept" nor that the language designers played it safe because there are stupid people in the world. Commented Nov 10, 2009 at 20:57
  • 6
    It has nothing whatsoever to do with people "being too stupid". Peter's point was that people would find this behaviour surprising, not incomprehensible. C# has been carefully designed to be unsurprising whenever possible. Commented Nov 10, 2009 at 21:19
  • 3
    If you are ever tempted to write a switch statement that switches on the type of an object, you really need to refactor and delegate the cases to the object implementations. In a well-designed OO system there should never be a need to do this. Commented Nov 10, 2009 at 21:19
  • 1
    Be aware that switching on object type is a strong code smell. Switching on a type to figure out what code to execute/which method to call is like saying "I wish all my objects I will encounter here had a method I could call right now". So a better question might be "Why do I have to switch on object type?" and when you answer that question fix the problem instead of the symptom :) Commented Nov 10, 2009 at 21:32