Results 1 to 8 of 8

Thread: Determining implements[Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Determining implements[Resolved]

    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
    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));
                                }
                            } 
    How can I figure that out?

    Thanks,
    Mike

    Edit: like this:
    Code:
    if (t.BaseType == typeof(Form) && typeof(MyInterface).IsAssignableFrom(t))
    Last edited by Mike Hildner; Aug 12th, 2004 at 02:31 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width