Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Getting type of anonymous interface

Avatar of kendolondon
kendolondon asked on
Visual Basic.NETMicrosoft Development
2 Comments1 Solution53 ViewsLast Modified:
Given an interface like this:

Public Interface IResultOf(Of T As spBaseResult)

    Sub SetData(ByVal data As T)

End Interface

And a class implementing the interface like this...

Public Class ucStandardResult
    Implements IResultOf(Of spSimpleResult)

    Public Sub SetData(data As spSimpleResult) Implements IResultOf(Of spSimpleResult).SetData

    End Sub

End Class

How can I externally establish the anonymous type that the class supports. I.e. I want to do something like.

If GetType(IResultOf(of spSimpleResult)).IsAssignableFrom(Instance.GetType) then....

Or to put it another way, if I had an object of type spSimpleResult, how would I go about finding, through code at runtime, a type that supports the interface IResultOf(Of spSimpleResult)

I hope that is clear!!!

Thanks in advance, Kenny
Avatar of Miguel Oz
Miguel OzFlag of Australia imageSenior Software Engineer
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers