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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:10:44+00:00 2026-05-16T01:10:44+00:00

I got a requirement in my project to add another property to some class.

  • 0

I got a requirement in my project to add another property to some class.
Now I want to avoid changing the class because I figured it shouldn’t be aware that he has this property (this property only has significance in the context of this project).

The way I thought to accomplish this was (Please critic this because I wanna know if there are simpler ways of doing this)

  1. Adding a new singleton class that has a mapping between objects of my class and the type of the property I wanted to add
  2. adding in this class an extension method (extension property?) to access the mapping and fetch the property.

Is there a simpler alternative?
Is this just unnecessary complexity? Maybe I should just add a new property to my class?

Thanks!

  • 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-16T01:10:44+00:00Added an answer on May 16, 2026 at 1:10 am

    The design you’ve described is actually the one used by Microsoft to implement the DependencyProperty system and, in particular, Attached Properties, though in the greater context of a binding framework. That said, using a dictionary with ‘attached’ data is a very typical solution when you need to tag a class with additional context for a particular use, but don’t want to modify the class.

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

Sidebar

Related Questions

iam working with a real time project where i got a requirement to find
For a specific requirement in my project, I want to retrieve JSON response from
I got the requirement to output some reports as Excel 2002 spreadsheets. Normally a
I have library project which referred by many applications. Now I got a new
I've got a unique requirement in my unique ASP.Net MVC project. Basically we are
I have a requirement on my new project to serve up some hidden assets
Got a requirement to rebuild mssql full-text index. Problem is - I need to
I got the requirement like, In a page there will be 4 panels which
I have got the requirement to find the core file in multiple box/machine and
I've got a requirement such that, when a user logs in while completing a

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.