checking types

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

I have this statement in C# i want to convert to vb.net but cant find a
direct conversion, how do i do it?

foreach(type iface in t.GetInterfaces())
{
if (iface.Equals(typeof(IMyInterface)))
{
/// do something
}
}

in vb.net i did

for each iface as type in t.GetInterfaces()
If iface.Equals(typeof(IMyInterface)) Then
''' do something
End If
next

which of course says IMyInterface is a type and connot be used as an
expression and 'is' is expected for the equals line... how do convert this?
i just want to check to see if an assembly implements a specific interface..
thanks!
 
i think this is the correct way? if there is a better one please let me know
if iface.Equals(GetType(IMyInterface)) Then
 
This might work:

foreach f as iface in t.GetInterfaces
if typeof f is IMyInterface
' dosomething
next
 
Back
Top