.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 13th, 2005, 09:25 AM
steveb steveb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 steveb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 57 sec
Reputation Power: 0
vb.net reflection getinterface issue

hello,

I am having a nightmare with this.

anyway. lets start so you can share in the horror of reflection.

I have 1 class library containing 1 interface.

I have another class library which implements the interface as shown below.

Imports myinterfaces.Orders

Public Class externalclass
Implements IOrder

Public Function PeformOrderPunchout() As Boolean Implements IOrder.ProcessOrder
Return True
End Function

End Class

this all works as expected or at least it compiles!!

with me so far.??

Ok now the main application has a reference set to

myinterfaces.Orders which is working fine as well.

The main application then uses reflection to try an instantiate externalclass.
this works fine, I can locate the external assembly, and loop through its types ( only 1 of type externalclass!!)

However when i attempt to call mytype.GetInterface("myinterfaces.IOrder",true)

it returns a null object/nothing.

(i have tried referencing the interface name by all different conotations and combinations, fully qualified, half qualified, over qualified but still nothing is returned.)

the code below shows this, is there any way to test if the given type implements the interface via the actual interface type. '' ouch that hurts my head!

'this works fine
myassembly = myassembly.LoadFrom("externalclass.dll")
'this works fine
For Each mytype In myassembly.GetTypes
'this works fine
If mytype.IsPublic = True Then
'this does not works fine at all
objinterface = mytype.GetInterface("myinterfaces.Orders.IOrder", True)

'its weird mytype here contains a correct reference to externalclass and the external class definately implements iorder
'e.g mytype.fullname = "externalclass"
End If

Next

can anyone help a man teetering on the edge of desperation?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > vb.net reflection getinterface issue


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT