471,347 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,347 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 1667
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Daniel Faensen | last post: by
8 posts views Thread by Phil D | last post: by
3 posts views Thread by Arjang | last post: by
5 posts views Thread by dj | last post: by
18 posts views Thread by Tony | last post: by

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.