Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Assemblée pour les événements chargés

Charger,une,Assemblée,avec,un,nom
{filelink=17563}

using System;
using System.Reflection;
 
class LesAssemblées {
 
   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("Assemblées chargées: " + args.LoadedAssembly.FullName);
      Console.WriteLine();
   }
}

No comments yet.

Leave a Comment