I want to look at types in assemblies and determine one, if it's a Form, but also if it implements an interface - say MyInterface.
Here's what I have so far
How can I figure that out?PHP Code:Assembly a = Assembly.LoadFrom(fileName);
Type[] types = a.GetTypes();
foreach (Type t in types)
{
if (t.BaseType == typeof(Form)) // and it implements MyInterface ???
{
Application.Run((Form)Activator.CreateInstance(t));
}
}
Thanks,
Mike
Edit: like this:
Code:if (t.BaseType == typeof(Form) && typeof(MyInterface).IsAssignableFrom(t))




Reply With Quote