Assembly loaded event
using System;
using System.Reflection;
class Test {
public static void Main() {
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyLoad += new AssemblyLoadEventHandler(MyAssemblyLoadEventHandler);
PrintLoadedAssemblies(currentDomain);
currentDomain.CreateInstance("System.Windows.Forms, Version, Culture, PublicKeyToken", "System.Windows.Forms.TextBox");
PrintLoadedAssemblies(currentDomain);
}
static void PrintLoadedAssemblies(AppDomain domain) {
foreach (Assembly a in domain.GetAssemblies()) {
Console.WriteLine(a.FullName);
}
}
static void MyAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args) {
Console.WriteLine("ASSEMBLY LOADED: " + args.LoadedAssembly.FullName);
Console.WriteLine();
}
}
Related examples in the same category