Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / December 2005

Tip: Looking for answers? Try searching our database.

Finding only implemented Interfaces on a type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Strahl [MVP] - 12 Dec 2005 20:38 GMT
Hi all,

I'm looking at a way to find only the implemented interfaces on a given
type. I can retrieve all the interfaces easily enough, but I can't figure
out a way to either filter the returned interface list or otherwise
consistently check for whether the interface is implemented on the current
type.

I have a hack I've used in the past that uses an InterfaceMap:

http://west-wind.com/weblog/posts/1620.aspx

This work on non-generic types and as long as the type implements at least 1
method that can be mapped somehow. It's a hack at best.

Does anybody know of a better way to do this? It seems there's gotta be a
way to filter the Interface list somehow...

+++ Rick ---

Signature

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

Baileys - 14 Dec 2005 09:17 GMT
Rick,

I'm not sure if this is what you're looking for, but you might want to try
the metadata API's (GetInterfaceImplProps seems to do the job). They're
unmanaged and somewhat more complex that the Reflection API's though...

see
http://blogs.msdn.com/jmstall/archive/2004/10/30/250007.aspx

and
http://www.ssw.uni-linz.ac.at/Teaching/Lectures/Sem/2001/Literatur/MetadataAPI.d
oc#_Toc491057185

(watch for line-wraps)

HTH,
Baileys

> Hi all,
>
[quoted text clipped - 15 lines]
>
> +++ Rick ---
Rick Strahl [MVP] - 14 Dec 2005 23:11 GMT
Thanks for the links...

This actually led me to a couple of interesting related topics which is
going to help with some other stuff I'm working on.

I don't see anything in the non-managed interfaces that makes retrieving the
Interface definitions any easier either though....

+++ Rick ---

Signature

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

> Rick,
>
[quoted text clipped - 33 lines]
>>
>> +++ Rick ---

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.