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 something like the webkit dev tools for analyzing web pages. Ideally it
Looking for simple php class routing, like this: http://fatfree.sourceforge.net/page/routing-engine Is there a ready-made solutions?
Looking at Splunk, http://www.splunk.com , it looks like a very nice platform for analysing
Looking for a good set of base objects to start a website up in
Looking back at my past projects I often encounter this one: A client or
looking for windows software who can draw a Use Case diagram like yuml.me anyone
Looking through the achievement list for Visual Studio 2010, it says that there is
Looking for an equivalent container class that matches to C#'s Arraylist collections class. Is
Looking for a good example of how to set up child models in knockoutjs.
Looking at the new spring property support in 3.1 ( http://blog.springsource.org/2011/02/15/spring-3-1-m1-unified-property-management/ ), it looks

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.