|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > vb.net reflection getinterface issue |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|