Results 1 to 4 of 4

Thread: How do I tell if a class implements an interface?

  1. #1

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

    How do I tell if a class implements an interface?

    I've tried TypeOf, which doesn't seem to give me what I want, can't figure out the syntax to IsAssignableFrom.

    TIA,
    Mike

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    A search for 'plugin' in the vb.net section should get a lot of good info but this post in particular should be helpful: http://www.vbforums.com/showthread.p...hreadid=194447

    As for this and other posts it seems like this is the general direction you are headed.

    Oh and to directly answer the question, one easy way is to see if GetInterface returns nothing on the object. If it does then it does NOT implement the interface otherwise it does and returns the interface type info.

    Also another option is to use a BaseClass instead of Interface and the IsSubClass function to test for existance.
    Last edited by Edneeis; Jan 12th, 2004 at 12:08 PM.

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    LOL. The post that wouldn't die!



    It takes the award for most referenced post.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Long live post 194447!!!!

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