Unload an Application Domain
Imports System
Imports System.Reflection
Class AppDomain2
Public Shared Sub Main()
Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", Nothing)
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName)
Console.WriteLine("child domain: " + domain.FriendlyName)
AppDomain.Unload(domain)
Try
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName)
Console.WriteLine("child domain: " + domain.FriendlyName)
Catch e As AppDomainUnloadedException
Console.WriteLine("The appdomain MyDomain does not exist.")
End Try
End Sub
End Class
Related examples in the same category