Programming language books usually explain that value types are created on the stack, and reference types are created on the heap.
My question is Why.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why do they "explain" that? Because sometimes the authors don’t know any better themselves, and sometimes they’re too lazy to explain it properly. The truth it rather more complicated.
Fortunately, Eric Lippert has written extensively around this:
While I would usually try to at least include a paraphrase of the full answer here, I’m not going to do so here – because explaining it very briefly is almost bound to give a misleading result. Just go and read those blog posts – and then everything else Eric has written. It’ll take weeks, but you’ll be glad you did.