References are not addresses
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.
Related posts:
- Using Object IDs in C#’s Debugger to chase object references I’ve needed this a few times in the past and...
- 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. ...
- Instant Twitter Bookmark Tonight’s been a busy night for silly coding This first...
- Covariance and Contravariance Covariance and Contravariance are terms used in programming languages and...
- Mapping Database Tables To Objects In my last article on the topic of database development,...