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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:24:04+00:00 2026-05-30T22:24:04+00:00

The title may sound a little strange, so I’ll try to explain my problem:

  • 0

The title may sound a little strange, so I’ll try to explain my problem:

Lets say I have a class that holds some Information:

class InfoHolder
{
  public int MyInfo1 {get; set;}
  public int MyInfo2 { get; set; }
}

Then I have another class, that does something with an info:

class InfoGUIRepresenter
{
  // Display an int in some kind of GUI
  // Allow the user to change the int via the GUI
}

Now I would need two objects of the representer class, to expose my Info-class to the user: One representer for each of the two infos. To achieve that it would be nice to pass each of the properties as some kind of “parameter” to my representer classes.
But of course that’s not possible in C#. Another solution would be to pass the names of the properties and then use reflection to access them – not very nice!

Is there any solution to this? Maybe some kind of architecture that addresses this kind problem?
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-30T22:24:06+00:00Added an answer on May 30, 2026 at 10:24 pm

    One option is to pass two delegates – one for the setter and one for the getter:

    var holder = new InfoHolder();
    
    var representer = new InfoGUIRepresenter(() => holder.MyInfo1,
                                             value => holder.MyInfo1 = value);
    

    Then your InfoGUIRepresenter constructor would take a Func<int> and an Action<int>. (Or you could make the representer generic, for different types of property.)

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

Sidebar

Related Questions

Ok, the title may sound a little weird, but I think that kinda describe
This title may seem strange, so let me try to explain what I'm trying
The title may have been confusing, but please let me explain: Currently when I
The title may sound simple and dumb, but allow me to explain. I am
The question's title may sound stupid, but I have beenw wondering about the following
Ok Title may not be clear so let me explain. I have 2 classes,
I realise that the title may be very confusing, so to explain what I
My title may be a bit unclear so I'll try to explain a bit
I'm here again with another question/problem. I know that topic's title may be like
I know that the title may sound absurd, but I don't know ho 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.