Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 475447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:23:21+00:00 2026-05-13T00:23:21+00:00

When reflecting on an interface type, I only get the members of the specific

  • 0

When reflecting on an interface type, I only get the members of the specific type, not inherited members.

In this over-simplified example, the program only prints “Name”, not “ItemNumber”, “Name” as I would expect:

using System;

public interface IBasicItem
{
    string ItemNumber { get; set; }
}

public interface IItem : IBasicItem
{
    string Name { get; set; }
}

class Program
{
    static void Main(string[] args)
    {
        var type = typeof (IItem);
        foreach (var prop in type.GetProperties())
            Console.WriteLine(prop.Name);
    }
}

What is the rationale behind this ? When I am inheriting from the base interface, I am saying that any of the implementations of my interface, must also implement the inherited members. In other words, IItem is-a IBasicItem. So why does the inherited member not show up using reflection ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:23:22+00:00Added an answer on May 13, 2026 at 12:23 am

    I think this is exactly what Phil Haack just blogged about.

    From the ECMA-335 Common Language Infrastructure specification:

    8.9.11 Interface type derivation Interface types can require the
    implementation of one or more other
    interfaces. Any type that implements
    support for an interface type shall
    also implement support for any
    required interfaces specified by that
    interface. This is different from
    object type inheritance in two ways:

    • Object types form a single inheritance tree; interface types do
      not.
    • Object type inheritance specifies how implementations are inherited;
      required interfaces do not, since
      interfaces do not define
      implementation. Required interfaces
      specify additional contracts that an
      implementing object type shall
      support.

    To highlight the last
    difference, consider an interface,
    IFoo, that has a single method. An
    interface, IBar, which derives from
    it, is requiring that any object type
    that supports IBar also support IFoo.
    It does not say anything about which
    methods IBar itself will have.

    Referenced from:
    http://haacked.com/archive/2009/11/10/interface-inheritance-esoterica.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reflecting a property 'Blah' its Type is ICollection public ICollection<string> Blah { get;
Is there a way to get a list of interface members? I know about
I'm creating instances of a generic type using reflection: public interface IModelBuilder<TModel> { TModel
While reflecting with ILSpy i found this line of code in the Queue<T>.Enqueue(T item)
I'm reflecting a C++/CLI method that has the following signature: void foo(long n); This
Using reflection, I'm able to filter members based on whether they are inherited, declared,
System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(path)) So this is a work around to not being able to use T4
The scenario goes like this - I have an assembly say 'MyAssembly'. An interface
Is there a way to invoke a generic function with a type known only
I have some tricky generic type problem involving reflection. Here's the code. public @interface

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.