title: How to get stack memory address of a string in visual studio 2010 C#
body: <p>I am currently doing a course at college in computer science and we recently saw how to get memory addresses of variables with &amp; and * in the debugger. My teacher told that local value type variables are in the stack and reference type are in the heap. But he also told that the stack should contain the address where strings are in the heap. </p>
  
  <p>I don't know if you understand what I'm trying to say but it should be possible because I saw it in the notes he gave to us. But when he tried to show us, it didn't work and he didn't know why. </p>
  
  <p>I want to know how to do it but when I try I always get this error message: </p>
  
  <blockquote>
    <p>Cannot take the address of, get the size of, or declare a pointer to a managed type ('string'). </p>
  </blockquote>
  
  <p>I write <code>&amp;nameofstringvariable</code> without quotes in the debugger. I like to understand how things work and I searched hours on google for this problem but I never found a solution. Tried with <code>unsafe</code> code and it didn't work.</p>