Qus: What is Application Domain and how does it work?
How does application domain work -
If you run code in 2 different AppDomains within a process, the code will run in isolation. Any communication between the AppDomains will get either serialized or handled via MarshallByRefObject. It behaves very much like using remoting in this regard. This provides a huge amount of security - you can run code that you don't trust, and if it does something wrong, it will not affect you.
.NET applications, however, are not hosted like traditional applications by Windows Operating System. Under .NET, .EXEs are hosted under a process by logical partitioning which is known as "Application Domain". Now you can host multiple application domains under one single process.
Application Domains consume less memory and power for processing the applications compared to the traditional processes for each application. In case one application domain fails, the other application domain will work as-is without any effects. You can also stop one application domain without affecting another application domain or without stopping an entire process.
One Application Domain cannot share/access the data from other Application Domain which is running within the same Domain or other Domain.