VB.Net by API/System.Reflection/AppDomain — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:40, 26 мая 2010
Содержание
AppDomain.CreateDomain
Imports System.Reflection
Public Class Tester
Public Shared Sub Main
Dim myAppDomain As AppDomain
Try
myAppDomain = AppDomain.CreateDomain("YourDomain")
Console.WriteLine(myAppDomain.FriendlyName)
AppDomain.Unload(myAppDomain)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
AppDomain.CurrentDomain
Imports System.Reflection
Public Class Tester
Public Shared Sub Main
Dim myCurrentAppDomain As AppDomain
Dim myAssemblies() As [Assembly]
Dim myAssembly As [Assembly]
Try
myCurrentAppDomain = AppDomain.CurrentDomain
myAssemblies = myCurrentAppDomain.GetAssemblies
For Each myAssembly In myAssemblies
Console.WriteLine(myAssembly.FullName)
Next
Console.WriteLine(myCurrentAppDomain.FriendlyName)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
AppDomain.CurrentDomain.BaseDirectory()
public class Test
public Shared Sub Main
Console.WriteLine(System.AppDomain.CurrentDomain.BaseDirectory())
End Sub
End Class
AppDomain.FriendlyName
Imports System.Reflection
Public Class Tester
Public Shared Sub Main
Dim myAppDomain As AppDomain
Try
myAppDomain = AppDomain.CreateDomain("YourDomain")
Console.WriteLine(myAppDomain.FriendlyName)
AppDomain.Unload(myAppDomain)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
AppDomain.GetAssemblies
Imports System.Reflection
Public Class Tester
Public Shared Sub Main
Dim myCurrentAppDomain As AppDomain
Dim myAssemblies() As [Assembly]
Dim myAssembly As [Assembly]
Try
myCurrentAppDomain = AppDomain.CurrentDomain
myAssemblies = myCurrentAppDomain.GetAssemblies
For Each myAssembly In myAssemblies
Console.WriteLine(myAssembly.FullName)
Next
Console.WriteLine(myCurrentAppDomain.FriendlyName)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
AppDomain.GetCurrentThreadId()
Imports System
Imports System.Configuration
Imports System.Resources " Resource readers
Public Class MainClass
Shared Sub Main()
Console.WriteLine("App_ThreadExit on thread id= " & System.AppDomain.GetCurrentThreadId().ToString())
End Sub
End Class
AppDomain.Unload
Imports System.Reflection
Public Class Tester
Public Shared Sub Main
Dim myAppDomain As AppDomain
Try
myAppDomain = AppDomain.CreateDomain("YourDomain")
Console.WriteLine(myAppDomain.FriendlyName)
AppDomain.Unload(myAppDomain)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Class