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 161809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:16:45+00:00 2026-05-11T11:16:45+00:00

I am looking to ‘extending’ an interface by providing set accessors to properties in

  • 0

I am looking to ‘extending’ an interface by providing set accessors to properties in that interface. The interface looks something like this:

interface IUser {     string UserName     {         get;     } } 

I want something like this:

interface IMutableUser : IUser {     string UserName     {         get;         set;     } } 

I need the inheritence. I cannot copy the body of IUser into IMutableUser and add the set accessors.

Is this possible in C#? If so, how can it be accomplished?

  • 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. 2026-05-11T11:16:46+00:00Added an answer on May 11, 2026 at 11:16 am

    I don’t see any reason why what you have posted shouldn’t work? Just did a quick test and it compiles alright, but gives a warning about hiding. This can be fixed by adding the new keyword, like this:

    public interface IMutableUser : IUser {     new string Username { get; set; } } 

    An alternative would be to add explicit set methods; eg:

    public interface IMutableUser : IUser {     void SetUsername(string value); } 

    Of course, I’d prefer to use setters, but if it’s not possible, I guess you do what you have to.

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

Sidebar

Related Questions

Looking for best advice on how to do this: I have an insert like
Looking for simple php class routing, like this: http://fatfree.sourceforge.net/page/routing-engine Is there a ready-made solutions?
Looking for something like the webkit dev tools for analyzing web pages. Ideally it
Looking at this array, one can see that only the foo6 value differs from
Looking at the source of a website today I came across something that surprised
Looking to create a vertical button group that looks very similar to Twitters own
Looking to do a bit of refactoring... Using NHibernate I have this query currently
Looking for a control that allows to select one text value at a time
Looking for something similar to Python's regex sub or subn methods. http://docs.python.org/library/re.html So basically
Looking for web service that download a webpage (we'll provide the URL), normalize it

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.