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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:43:44+00:00 2026-06-04T22:43:44+00:00

I have a chart, and I have a tree view with nodes that when

  • 0

I have a chart, and I have a tree view with nodes that when selected bring up various charts. The tree view nodes are named xxxChart, and the methods that bring up the various charts are named xxxChart after whichever node that calls it.

There are parameters that can be changed (start/end date for example) and when that happens I need to run the method for the current chart again to refresh it with the updated parameter selection. I thought it would be a good idea to have an Action object called DisplayChart that would be set whenever a node is selected. Then when a parameter is changed I just call DisplayChart().

Now, I welcome any ideas you may have for better patterns to solve this problem but my question is this: How can I use reflection to get something I can assign to the Action object? I know how to invoke a method using reflection, but when a node is selected I just want to store the method with the name matching that node in the DisplayChart Action object.

Of course, I know I could just use a MethodInfo object instead of an Action object and then use reflection to invoke the method, but I’m still curious how to do it this way.

  • 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-06-04T22:43:46+00:00Added an answer on June 4, 2026 at 10:43 pm

    Relying on method naming conventions and reflection isn’t very robust, but to answer your question directly, you can use one of the overloads of Delegate.CreateDelegate.

    E.g.

    object boundObject = ...
    MethodInfo method = ...
    
    Action action = (Action)Delegate.CreateDelegate(typeof(Action), 
                                                    boundObject, 
                                                    method);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a chart generated from Google Charts that can be found here: Chart
I have a tree structure that represents an org chart and I need to
I have chart.png with data in it that I would like to put a
I have a chart (code to replicate will be below) that has two lines
In my MVC project I have a chart being generated on my view as
I have a line chart that is updated every so and so seconds, similar
I have a tree in WPF that has no root node, but has defined
I have a parse tree that parses out a stack of a stack of
I have a function that writes things from a binary tree. When I run
I have a stored procedure which deals with adding nodes in a tree. Basically

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.