title: Where are all the static members stored?
body: <p>I'm trying to learn how C# manages memory. I am stuck on static elements, I read numerous blogs and articles on this subject, but I cannot find a quite satisfactory answer.</p>
  
  <p>Let's define a code block to help find the answer. </p>
  
  <pre><code>class myClass
  {
      static string myStr = "String Data";
      static int myInt = 12;
  }
  </code></pre>
  
  <p>Before you guys share your answer, let me share my findings that I know about this subject. Feel free to agree or disagree and help me to find correct answer.</p>
  
  <ul>
  <li>Static is just for the lifetime.</li>
  <li>A static reference type (myStr), will go on heap, for life time.</li>
  <li>A static value type (myInt), will go on stack, for life time.</li>
  </ul>
  
  <p>What confuses me, are some answers that I found on internet, on this subject. </p>
  
  <p>Confusion Number 1:</p>
  
  <blockquote>
    <p>When your program starts, it loads all the related assemblies into an AppDomain. When the assembly is loaded, all static constructors are called, including static fields. They will live in the there, and the only way to unload them, is to unload the AppDomain.</p>
  </blockquote>
  
  <p>In above lines, it is mentioned explicitly that all static elements stored on AppDomain. Then why everybody on internet says 'Static' elements are stored on heap/stack?</p>
  
  <p>Confusion Number 2:</p>
  
  <blockquote>
    <p>Every static variable is stored on the heap, regardless of whether it's declared within a reference type or a value type.</p>
  </blockquote>
  
  <p>If every static variable stored on heap. Then why some folks says that value type static variable are stored on stack?</p>
  
  <p>Please help to connect my dots to understand memory management of static variables in C#. Thank you very much for your precious time :)</p>