References are not addresses

February 19th, 2009 by Xerxes Leave a reply »

Just read this excellent post by Eric Lippert about why it is incorrect to describe references in .NET as a pointer to a memory location

In the article he goes on to explain the differences between a pointer and a reference, and why they are not mutually interchangeable.

I have to admit, I’ve been incorrectly defining a reference. After reading this article from now on my definition of a “reference type” will be a type which contains a reference to an object held internally within the .NET GC. This reference is not *necessarily* a pointer and should be thought of more like a unique handle to the GC’s object than a pointer to a memory address.

Be Sociable, Share!

Related posts:

  1. Using Object IDs in C#’s Debugger to chase object references I’ve needed this a few times in the past and...
  2. Writing Tests to Catch Memory Leaks in .NET http://brian.genisio.org/2008/11/writing-tests-to-catch-memory-leaks-in.html keeping for my own reference purposes....
  3. Instant Twitter Bookmark Tonight’s been a busy night for silly coding This first...
  4. Covariance and Contravariance Covariance and Contravariance are terms used in programming languages and...
  5. Mapping Database Tables To Objects In my last article on the topic of database development,...

Comments are closed.