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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:35:54+00:00 2026-05-20T18:35:54+00:00

In my project, I am creating generic interfaces to be used by a number

  • 0

In my project, I am creating generic interfaces to be used by a number of classes. This includes some properties that must always be present.

Some of the classes will be generic, and therefore the property must be changeable at run-time. Some of the classes will be highly specialized, and therefore, the value of the property will be hard-coded. I would like to be able to use Bindings in the user interface to display and, where possible, edit the values. Also, I can imagine that at some point, I would want to use reflection to determine if the properly is settable.

What is the best way to accomplish this?

1) Define the properties as read-write in the interface, but have an empty setter in the specialized classes. This appears to be a somewhat common practice, but I am concerned with how binding and reflection would work. A UI control would still appear editable, just that the change by a user would not take, right?

2) Define the properties as read-only in the interface, but provide a setter in the generic classes. I would expect that the UI, bound to use the interface, would still see the property as read-only, and not allow editing.

3) Define the properties as read-only in the interface, but provide some other function to change the value in generic classes. This clearly breaks the property paradigm, and a binding wouldn’t know about it to allow editing.

Is there some other way to enable or disable the setters that would be recognized by bindings and 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-20T18:35:55+00:00Added an answer on May 20, 2026 at 6:35 pm

    OK, here my 2 cents – you might not like what I am going to say.

    If you have a property that is read-only sometimes and read-write other times and constant in the rest, you are having a leaky abstraction here were polymorphism probably will only result in confusion to the clients of your classes.

    So either I would have 2 interfaces one with read-write the other read-only, or just abandon polymorphism for such properties.

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

Sidebar

Related Questions

I am creating a program that will be installed using the .net installer project.
I'm currently working on creating a new C# project that needs to interact with
I am creating a number of custom controls for a Silverlight 4 project. I
In a proof-of-concept project I'm working on, I have a generic abstract class that
I'm always looking for a modern Java library that makes creating valid (X)HTML snippets
Does anybody know of any open source project that deals with creating forms or
I'm currently planning out a project involving creating a shell replacement for Windows (based
I am creating windows installer project using Visual Studio 2005. Is there an option
I am creating an RSS reader as a hobby project, and at the point
I am creating a new build process for a DotNet project which is to

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.