LA.NET [EN]

Mar 14

As you know, C# supports the concepts of references and value types. Most of the time, reference types tend to be presented as some sort of synonym for a memory address. I’ve seen it everywhere and I’ve used that analogy too when trying to help others to understand the difference between value types and reference types. Now, this kind of analogy tends to break when you start thinking about the memory model and on how GC works.

Say, if reference type is an address, then why do I need to pin it before saving a reference to that address? If you think about references without the address analogy, things start to make more sense…This is just an example of the kind of questions you might end up being asked when you use this sort of analogy to introduce reference types. Fortunately, we’ve got people like Eric Lippert who really  know their stuff and do have the time (and will!) to explain why that is not a good analogy.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>