473,396 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How weknows the implemented Interface name at run time

Hi,

Is there any method to know the interface name through which the class has been implemented?

Example:

Public Interface I1
Public funcation Test() as string
End Interface

Public Class C1
Implements I1

Public function Test()as string implements I1.Test
msgbox("Hello")
End Function
End Class

Public Class C2
Public function Test1(classobj as Object)
' Code to know about the implemented interface name of class C1
' I used following code, but it was not working.
If classobj.getType is GetType(I1) then
' Some code
End If
End Function
End Class

Regards,
Ashish
Sep 26 '08 #1
2 1047
balabaster
797 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. Dim oType As Type = MyObject.GetType()
  2. Dim oInterfaces As Type() = oType.GetInterfaces()
  3. For Each oInterface As Type In oInterfaces
  4.     Console.WriteLine(oInterface.ToString())
  5. Next
Sep 26 '08 #2
Thanks,

This will works...

-- Ashish
Sep 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Choubey | last post by:
hi everybody, Iam a java programmer actually i want to know how the Connection object is created through DriverManager.getConnection when DriverManager class is not implements Connection...
2
by: PatrickSA | last post by:
Hi, Am new to web services, so apologies for the basic nature of the question - and apologies in advance if this is the wrong newsgroup. We're building a new web service and I'm looking around...
6
by: Chris Dunaway | last post by:
I have a simple interface with two methods, MethodA, and MethodB. I also have a class with implements the interface. The class provides a full implementation for MethodA but for special reasons,...
0
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What...
7
by: Christopher Wells | last post by:
There's something I don't understand about how the CollectionBase class is defined. I can declare: class Derived : CollectionBase { } I can instantiate this Derived class: Derived derived...
15
by: Gustaf | last post by:
Using VS 2005. I got an 'IpForm' class and an 'IpFormCollection' class, containing IpForm objects. To iterate through IpFrom objects with foreach, the class is implemented as such: public class...
15
by: Xah Lee | last post by:
On Java's Interface Xah Lee, 20050223 In Java the language, there's this a keyword “interface”. In a functional language, a function can be specified by its name and parameter specs....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.