473,405 Members | 2,160 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,405 software developers and data experts.

Iterate through all the interfaces supported by an object

If I have an "object", how can I list all the interfaces that the
object implements? I just want to list the string "names" of the
interfaces...

Dec 16 '05 #1
1 1731
Dave,
You can get Type.GetInterfaces to get the list of Interfaces that the type
implements. You can then use Type.Name to get the name of the interface.

Something like:

Object anObject = ...

Type theType = anObject.GetType();
foreach(Type anInterface in theType.GetInterfaces())
{
Debug.WriteLine(anInterface.Name, "interface");
}
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Dave" <dp*@eliassen.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| If I have an "object", how can I list all the interfaces that the
| object implements? I just want to list the string "names" of the
| interfaces...
|
Dec 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Code4u | last post by:
My colleagues and I have been discussing techniques for implementing interfaces in C++. We're looking for a mechanism similar to COM's QueryInterface, in which a certain types of objects can be...
2
by: Daniel Faensen | last post by:
As a good OO programmer that I hopefully am I prefer to implement against interfaces rather than classes. This is especially useful when it comes to multiple inheritance which is as you know an...
8
by: Phil D | last post by:
Hi, I am new to c# and oop and have a question about interfaces which I hope someone can help me with. The book I am using (C# Step by Step) explains how to create and implement interfaces...
3
by: Arjang | last post by:
suppose I have an interface reference IA, to an object implementing let's say, InterfaceA. Is it possible to query IA and find out whether some other interface e.g. IntefaceB is also supported?...
5
by: dj | last post by:
I know seasoned OOP-savvy developers will roll their eyes at this one, but can anyone provide a clear explanation as to *why* one would need to use an Interface in a VB.NET application? Every...
1
by: Dave | last post by:
If I have an "object", how can I list all the interfaces that the object implements? I just want to list the string "names" of the interfaces...
3
by: Jeff User | last post by:
Hi I want to create a rather simple object with a few string attributes to hold some database user information such as: public class UserInfo { //Basic user information for each user...
18
by: _dee | last post by:
Question about best use of interfaces: Say there's a 'Master' class that needs to implement a few interfaces: class Master : I1, I2, I3 { } The actual code already exists in smaller...
18
by: Tony | last post by:
class Interface { public: virtual void DoItNow()=0; }; class A: public Interface { public: void DoItNow(); // satisfies interface explicitly
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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 project—planning, 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.