473,320 Members | 1,978 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,320 software developers and data experts.

question on inheritance of interfaces..


I have interface IAbc,IDef

and interface IXyz inherits/implements(what is the right word) IAbc
and IDef
if i reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.

Why?

TIA
Mar 5 '08 #1
6 1134
On Mar 5, 5:52*pm, parez <psaw...@gmail.comwrote:
* I have interface IAbc,IDef

and *interface *IXyz inherits/implements(what is the right word) IAbc
and IDef

*if *i *reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.

Why?

TIA
Let me see if I understand this:
You have an interface named IXYZ that implements IABC and IDef

public interface IABC
{
void MethodFromABC();
}

public interface IDef
{
void MethodFromIDef();
}

public inteface IXYZ : IDef, IABC
{
void MethodFromIXYZ();
}

Running reflection against IXY only returns MethodFromIXYZ()?

Is that correct?
Mar 6 '08 #2
On Mar 5, 8:18 pm, chrisro...@gmail.com wrote:
On Mar 5, 5:52 pm, parez <psaw...@gmail.comwrote:
I have interface IAbc,IDef
and interface IXyz inherits/implements(what is the right word) IAbc
and IDef
if i reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.
Why?
TIA

Let me see if I understand this:
You have an interface named IXYZ that implements IABC and IDef

public interface IABC
{
void MethodFromABC();

}

public interface IDef
{
void MethodFromIDef();

}

public inteface IXYZ : IDef, IABC
{
void MethodFromIXYZ();

}

Running reflection against IXY only returns MethodFromIXYZ()?

Is that correct?
Correct...
Mar 6 '08 #3
parez wrote:
I have interface IAbc,IDef

and interface IXyz inherits/implements(what is the right word) IAbc
and IDef
if i reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.

Why?
Because you didn't use BindingFlags.FlattenHierarchy
>
TIA

Mar 6 '08 #4
On Mar 6, 9:43 am, "Ben Voigt [C++ MVP]" <r...@nospam.nospamwrote:
parez wrote:
I have interface IAbc,IDef
and interface IXyz inherits/implements(what is the right word) IAbc
and IDef
if i reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.
Why?

Because you didn't use BindingFlags.FlattenHierarchy
TIA
can you please shed some more light on it..
Mar 6 '08 #5
On Mar 6, 10:08*am, parez <psaw...@gmail.comwrote:
On Mar 6, 9:43 am, "Ben Voigt [C++ MVP]" <r...@nospam.nospamwrote:


parez wrote:
*I have interface IAbc,IDef
and *interface *IXyz inherits/implements(what is the right word) IAbc
and IDef
if *i *reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.
Why?
Because you didn't use BindingFlags.FlattenHierarchy
TIA

can you please shed some more light on it..- Hide quoted text -

- Show quoted text -
I don't think FlattenHierarchy works with interfaces. Found this on
the MSDN boards:

ShowInterfaceMethods(typeof(myInterface));

ShowInterfaceMethods(Type iType)
{
foreach (MethodInfo mi in
iType.GetMethods(BindingFlags.Public | BindingFlags.Instance |
BindingFlags.FlattenHierarchy))
{

Console.Writeline(mi.Name);
}

foreach (Type IBase in iType.GetInterfaces())
{

GetInterfaceMethods(IBase);

}

}
Mar 6 '08 #6
On Mar 6, 10:08 am, parez <psaw...@gmail.comwrote:
On Mar 6, 9:43 am, "Ben Voigt [C++ MVP]" <r...@nospam.nospamwrote:
parez wrote:
I have interface IAbc,IDef
and interface IXyz inherits/implements(what is the right word) IAbc
and IDef
if i reflect the type IXyz it only shows me the members of IXyz and
not IAbc and IDef.
Why?
Because you didn't use BindingFlags.FlattenHierarchy
TIA

can you please shed some more light on it..
Thanks both.. .I got what i wanted..

But is there a reason why I have to do that? Is it an oversight on ms
side?
Mar 6 '08 #7

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

Similar topics

12
by: Steve Jorgensen | last post by:
The classing Visual Basic and VBA support for polymorphism, let's face it, is a bit on the weak side, and built-in support for inheritance is non-existent. This little essay is about some patterns...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
7
by: Hazz | last post by:
Are there any good references/articles/books which provide clarity toward my insecurity still on deciding how to model a complex system? I still feel uncomfortable with my understanding, even...
13
by: John Salerno | last post by:
Hi all. I have a question about interfaces now. According to the book I'm reading, when you implement an interface, the class or structure has to declare all the methods that the interface...
12
by: Michael S | last post by:
Why do people spend so much time writing complex generic types? for fun? to learn? for use? I think of generics like I do about operator overloading. Great to have as a language-feature, as...
7
by: tshad | last post by:
I am trying to understand why I would use interfaces. In the following example for IPrinciple, I have the following code: ************************************************************ using...
7
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears...
6
by: RSH | last post by:
I am still trying to grasp the use of real world Objects and how to conceptualize them using a business scenerio. What I have below is an outline that I am wrestling with trying to figure out a...
23
by: Dave Rahardja | last post by:
Since C++ is missing the "interface" concept present in Java, I've been using the following pattern to simulate its behavior: class Interface0 { public: virtual void fn0() = 0; };
18
by: GD | last post by:
Please remove ability to multiple inheritance in Python 3000. Multiple inheritance is bad for design, rarely used and contains many problems for usual users. Every program can be designed only...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.