Browse by Tags

Tagged Content List
  • Blog Post: Debunking another myth about value types

    Here's another myth about value types that I sometimes hear: "Obviously, using the new operator on a reference type allocates memory on the heap. But a value type is called a value type because it stores its own value, not a reference to its value. Therefore, using the new operator on a value type allocates...
  • Blog Post: Chaining simple assignments is not so simple

    UPDATE: I interrupt this episode of FAIC with a request from my friend and colleague Lucian, from the VB team, who wonders whether it is common in C# to take advantage of the fact that assignment expressions are expressions. The most common usage of this pattern is the subject of this blog entry: the...
  • Blog Post: I have a Fit, but a lack of Focus.

    Here's a statement I read the other day about making comparisons between objects of reference type in C#: Object.ReferenceEquals(x,y) returns true if and only if x and y refer to the same object. True or false? My wife Leah recently acquired a Honda Fit, thanks to the imminant failure of...
  • Blog Post: Absence of evidence is not evidence of absence

    Today, two more subtly incorrect myths about C#. As you probably know, C# requires all local variables to be explicitly assigned before they are read, but assumes that all class instance field variables are initially assigned to default values. An explanation of why that is that I sometimes hear is...
  • Blog Post: Precedence vs order, redux

    Once more I'm revisting the myth that order of evaluation has any relationship to operator precedence in C# . Here's a version of this myth that I hear every now and then. Suppose you've got a field arr that is an array of ints, and some local variables index and value: int index = 0; int value =...
  • Blog Post: Not everything derives from object

    I hear a lot of myths about C#. Usually the myths have some germ of truth to them, like " value types are always allocated on the stack ". If you replace "always" with "sometimes", then the incorrect mythical statement becomes correct. One I hear quite frequently is "in C# every type derives from...
  • Blog Post: The Stack Is An Implementation Detail, Part One

    " style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px; BORDER-RIGHT-WIDTH: 0px" height=240 alt="Stack " src="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/TheStackIsAnImplementationDetail_C978/Stack_thumb_1...
Page 1 of 1 (7 items)