title: Good example of use of AppDomain
body: <p>I keep getting asked about AppDomains in interviews, and <a href="http://en.wikipedia.org/wiki/Appdomain" rel="noreferrer">I know the basics</a>:  </p>
  
  <ul><li>they are an isolation level within an application (making them different from applications)</li>
  <li>they can have threads (making them different from threads)</li>
  <li>exceptions in one appdomain do not affect another</li>
  <li>appdomains cannot access each other's memory</li>
  <li>each appdomain can have different security</li></ul>
  
  <p>I still don't get what makes them necessary. I'm looking for a reasonable concrete circumstance when you would use one.</p>
  
  <p>Answers:</p>
  
  <ul>
  <li>Untrusted code</li>
  <ul>
  <li>Core application protected<br />
  Untrusted/3rd party plugins are barred from corrupting shared memory and non-authorized access to registry or hard drive by isolation in separate appdomain with security restrictions, protecting the application or server. e.g. ASP.NET and SQL Server hosting component code</li>
  </ul>
  <li>Trusted code</li>
  <ul>
  <li>Stability<br />
  Application segmented into safe, independent features/functionality</li>
  <li>Architectural flexibility<br />
  Freedom to run multiple applications within a single CLR instance or each program in its own.</li>
  </ul>
  </ul>
  
  <p>Anything else?</p>