473,471 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Get Implementation/Interface Declaration from Method using Reflection?

Rob
I'm using reflection to inspect a class and its methods. Is is
possible to determine if the class is a derived class or an interface
implementation? I'm using the MethodInfo object for relfection that I
use for acquiring the function names, scope, parameters, etc. Is
there an "InheritedClassType" or "InterfaceType" property that I can
query? I've tried using DeclaringType.BaseType, but that doesn't seem
to give me what I want.

Regards,
Rob
Nov 20 '05 #1
2 2142
Rob wrote:
I'm using reflection to inspect a class and its methods. Is is
possible to determine if the class is a derived class or an interface
implementation? I'm using the MethodInfo object for relfection that I
use for acquiring the function names, scope, parameters, etc. Is
there an "InheritedClassType" or "InterfaceType" property that I can
query?
I've tried using DeclaringType.BaseType

This is correct, why doesn't it work? What are you expecting? Code?

For Interfaces:
Type.GetInterfaces()

Cheers

Arne Janning
Nov 20 '05 #2
Rob
Arne -

Thanks for your reply.

Type.GetInterfaces() did the trick for inspecting the interfaces (I
was hoping it would be much more difficult than that), but that gets
me half-way there. For inspecting base class information,
Type.BaseType works (not Type.DeclaringType.BaseType, which is what I
had been trying).

- Rob
Arne Janning <sp*****************@msn.com> wrote in message news:<et**************@tk2msftngp13.phx.gbl>...
Rob wrote:
I'm using reflection to inspect a class and its methods. Is is
possible to determine if the class is a derived class or an interface
implementation? I'm using the MethodInfo object for reflection that I
use for acquiring the function names, scope, parameters, etc. Is
there an "InheritedClassType" or "InterfaceType" property that I can
query?


I've tried using DeclaringType.BaseType

This is correct, why doesn't it work? What are you expecting? Code?

For Interfaces:
Type.GetInterfaces()

Cheers

Arne Janning

Nov 20 '05 #3

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

Similar topics

9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
3
by: Gergely Varadi | last post by:
public class A : IComparable { int IComparable.CompareTo(object obj) { return 1; } } /// <summary> /// <see cref="A.System.IComparable.CompareTo"/>
1
by: lewindha | last post by:
Hey guys I'm trying to populate a drop down list with values from a db table. When I view the page, the drop list is empty. Here is the code: private void populateClients() { string...
6
by: Anders Borum | last post by:
Hello! I accidentally posted this as a reply to another posting. It is a seperate posting - sorry :-) I am programming a cloning service (which is essential to the framework), and am...
1
by: Mitan | last post by:
Hello, I'm a beginner with what appears to be a simple question for which I haven't been able to get an answer. Can someone explain what "implementation code" is in relation to VB.NET? I want to be...
6
by: Kevin Yu | last post by:
hi all is there a way to pass an interface as input parameter for a web method? since interface is not serializable, does that mean it's impossible to do that? Kevin
7
by: tron.thomas | last post by:
Please consider the following code: class Abstract { public: virtual ~Abstract() {} virtual void Method() = 0; }; class Concrete : public virtual Abstract
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
0
by: Ken | last post by:
Hi I have a little application that does datavalidation. It supports dynamically loaded plugins (you drop a dll with a class implementing IValidator<Tin the same dir as the main application)....
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.