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 / .NET SDK / April 2005

Tip: Looking for answers? Try searching our database.

Interface Mapping with Metadata API

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Reinhard - 06 Apr 2005 14:14 GMT
I need to find out for class Foo whether a method implements a method
from interface IFoo or not. In case of method Bar() I can use
EnumMethodImpls, but for Baz() there is no MethodImpl entry.

 interface IFoo
 {
   void Bar();
   void Baz();
 }

 class Foo : IFoo {
   static void Main() { }
   void IFoo.Bar() {}     // EnumMethodImpls works
   public void Baz() {}   // no MethodImpl in Metadata
   public void Other() { }
 }

Is there any other API in Metadata that can do this? I dont want to
compare Name and Signature manually.
Jon Shemitz - 06 Apr 2005 18:11 GMT

> I need to find out for class Foo whether a method implements a method
> from interface IFoo or not. In case of method Bar() I can use
> EnumMethodImpls, but for Baz() there is no MethodImpl entry.

I'm not sure what the question is. If the class supports the
interface, you know it implements all methods in the interface. Do you
mean that you want to know ehether the class implements a particular
method directly, or whether it inherits it?

Signature

www.midnightbeach.com

Reinhard - 06 Apr 2005 19:46 GMT
With API IMetaDataImport::EnumInterfaceImpls I determine that class Foo
implements interface IFoo. Fine. Next thing is, I need to know whether
a particular method of Foo is implementing a method defined by
interface IFoo. In my example Bar() & Baz().

In the case of Bar() which is implemented by *explicitly* specifying
the IFoo.Bar, I can use IMetaDataImport::EnumMethodImpls to see that
CFoo.Bar implements IFoo.Bar. However for methods which do not
explicitly implement the interface (as for Baz()), there is no entry in
MethodImpls. There must be another API to get that information. This is
what I am looking for.

Background: My project is a recorder which uses the Profiling API of
Whidbey to record activiations of methods from a given interface
(filtered by interface). Example: "record all method calls which
implement IComparable".
Reinhard - 07 Apr 2005 08:26 GMT
Someone emailed me with an answer. I unintentionally deleted this
message from my mailbox. Can you please resend your message?

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.