forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource3.vb
23 lines (21 loc) · 918 Bytes
/
source3.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'<snippet3>
Imports System.Reflection
Class AppDomain2
Public Shared Sub Main()
Console.WriteLine("Creating new AppDomain.")
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()
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName)
' The following statement creates an exception because the domain no longer exists.
Console.WriteLine("child domain: " + domain.FriendlyName)
Catch e As AppDomainUnloadedException
Console.WriteLine(e.GetType().FullName)
Console.WriteLine("The appdomain MyDomain does not exist.")
End Try
End Sub
End Class
'</snippet3>