How to Create an Application Domain in C#

To create an application domain, we should call the AppDomain.CreateDomain method. We must provide a name for the new application domain.

AppDomain d = AppDomain.CreateDomain("NewDomain");
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("Child domain: " + d.FriendlyName);

We can access the application domain your assembly is currently running in by accessing AppDomain.CurrentDomain.

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.