Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Chargement dynamique des ‘Assembley’

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

using System;
using System.Reflection;
using System.IO;
 
public class ExAssembley
{
    static void Main(string[] argv)
    {
        AssemblyLoader("System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=6fabf065cd2c728", false);
        AssemblyLoader("System.Xml", false);
        AssemblyLoader("System.Drawing", true);
    }
 
    public static void AssemblyLoader(string LoadedAssemblyName, bool PartialName)
    {
        try
        {
            Assembly LoadedAssembly;
            Console.WriteLine("| Loading Assembly {0}", LoadedAssemblyName);
            if(PartialName == true)
                LoadedAssembly = Assembly.LoadWithPartialName(LoadedAssemblyName);
            else
                LoadedAssembly = Assembly.Load(LoadedAssemblyName);
 
            Console.WriteLine("Nom Complet: {0}", LoadedAssembly.FullName);
            Console.WriteLine("Emplacement: {0}", LoadedAssembly.Location);
 
        } catch(FileNotFoundException) {
            Console.WriteLine("Impossible de charger cet Assembley.");
        }
    }
 
}

No comments yet.

Leave a Comment