• [^] # Re: Type.GetInterfaces()

    Posté par . En réponse au message Problème avec IsSubclassOf. Évalué à 1.

    // check if this dll inherits PluginInterface
    foreach (Type type in asm.GetTypes())
    {
    // we're interested in the interface
    foreach(Type intrfce in type.GetInterfaces())
    {
    if (intrfce == typeof(PluginInterface))
    {
    Console.WriteLine("and this is a plugin");
    pluginList.Add((PluginInterface) Activator.CreateInstance(type));
    }
    else
    Console.WriteLine("but this is NOT a plugin ({0} != {1})", intrfce, typeof(PluginInterface));
    }
    }