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

  • SEARCH
  • Home
  • 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 467829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:37:16+00:00 2026-05-12T23:37:16+00:00

I have a set of interfaces which are used in close conjunction with particular

  • 0

I have a set of interfaces which are used in close conjunction with particular mutable object.

Many users of the object only need the ability to read values from the object, and then only a few properties. To avoid namespace pollution (easier intellisense) and to get across the usage intent, I’d like to have a small base interface which only exposes a few “key” properties in a read-only fashion.

However, almost all implementations will support the full interface, which includes modifiability.

Unfortunately, I ran into a roadblock expressing that concept in C#:

interface IBasicProps {
   public int Priority { get; }
   public string Name {get;}
   //... whatever
}

interface IBasicPropsWriteable:IBasicProps  {
   public int Priority { set; } //warning CS0108: [...] hides inherited member [...]
   public string Name { set; }
   //... whatever
}

I certainly wasn’t intending to hide any members, so that aint good!

Of course, I can solve this using methods just fine, but what’s the right choice? I’d like to keep the “core” interface as small as possible even if splitting the interfaces serves no purpose other than communicating intent. With split interfaces, it’s just really obvious which methods aren’t going to do any updating, and it makes writing code a bit clearer (not to mention also allows nice-n-simple static singleton stubs that suffice for quite a few simple cases).

I’d like to avoid any abstract classes and the like; they make reimplementation or quick single-purpose shims all that more complex and hard-to-grok.

So, ideas?

  • 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-12T23:37:17+00:00Added an answer on May 12, 2026 at 11:37 pm

    Method hiding in an interface isn’t nearly as grungy; I’d go with something like:

    interface IBasicProps {
       int Priority { get; }
       string Name {get;}
       //... whatever
    }
    
    interface IBasicPropsWriteable:IBasicProps  {
       new int Priority { get; set; }
       new string Name { get; set; }
       //... whatever
    }
    class Foo : IBasicPropsWriteable {
        public int Priority {get;set;}
        public string Name {get;set;}
    /* optional
        int IBasicProps.Priority {get {return Priority;}}
        string IBasicProps.Name {get {return Name;}}
    */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of different interfaces and I need to give them access
I have a set of classes and interfaces which have a relatively simple hierarchy,
I have written a set of classes and interfaces that are implemented in Moose
I have the following Interfaces: public interface ITemplateItem { int Id { get; set;
I have a program with a GUI interface whose initial set-up I need to
I have a jar which contains all my core functionalities and a set of
I have an application which is used for data analysis and I'm having a
I have a tun/tap device which is used to read incoming packets from one
We've got a set of classes which derive from a common set of interfaces
I have a form which is used as an interface for CRUD on database

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.