Umbrella provides an extension to ease the use of the Type.IsAssignableFrom
method.

For instance, to enumerate the types of an assembly that implement a specific interface :

    using nVentive.Umbrella.Extensions;


    public static class PluginHelper
    {
        public static IEnumerable<Type> EnumPlugins(Assembly assembly)
        {
           return from pluginType in assembly.GetTypes()
                  where pluginType.Is<IPlugin>()
                  select pluginType;
        }
    }

Last edited Feb 24, 2009 at 1:33 AM by jlaban, version 2

Comments

No comments yet.