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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:53:12+00:00 2026-05-10T23:53:12+00:00

Does someone knows if it’s possible to dynamically create a call chain and invoke

  • 0

Does someone knows if it’s possible to dynamically create a call chain and invoke it?

Lets say I have two classes A & B:

public class A     public function Func() as B         return new B()     end function end class  public class B    public function Name() as string       return 'a string';    end function end class 

I want to be able to get MethodInfo for both Func() & Name() and invoke them dynamically so that I can get a call similar to A.Func().Name().

I know I can use Delegate.CreateDelegate to create a delegate I can invoke from the two MethodInfo objects but this way I can only call the two functions separately and not as part of a call chain.

I would like two solutions one for .NET 3.5 using expression tree and if possible a solution that is .NET 2.0 compatible as well

  • 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-10T23:53:13+00:00Added an answer on May 10, 2026 at 11:53 pm

    Are you using .NET 3.5? If so, it should be relatively straightforward to build an expression tree to represent this. I don’t have enough expression-tree-fu to easily write the relevant tree without VS open, but if you confirm that it’s an option, I’ll get to work in notepad (from my Eee… hence the lack of VS).

    EDIT: Okay, as an expression tree, you want something like (C# code, but I’m sure you can translate):

    // I assume you've already got fMethodInfo and nameMethodInfo. Expression fCall = Expression.Call(null, fMethodInfo); Expression nameCall = Expression.Call(fCall, nameMethodInfo); Expression<Func<string>> lambda = Expression.Lambda<Func<string>>(nameCall, null); Func<string> compiled = lambda.Compile(); 

    This is untested, but I think it should work…

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

Sidebar

Ask A Question

Stats

  • Questions 89k
  • Answers 89k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The second one allows you to extend the number of… May 11, 2026 at 5:53 pm
  • Editorial Team
    Editorial Team added an answer There is a check box under the Advanced section of… May 11, 2026 at 5:53 pm
  • Editorial Team
    Editorial Team added an answer Here's my first attempt at this using vectors and strings:… May 11, 2026 at 5:53 pm

Related Questions

Does someone knows if it's possible to dynamically create a call chain and invoke
So, every time I have written a lambda expression or anonymous method inside a
I have the code for a javascript calendar and it works perfectly as it
The short version is: How do I learn the size (in bits) of an
I'm looking for a key/value pair object that I can include in a web

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.