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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:18:14+00:00 2026-05-24T04:18:14+00:00

Any help would be appreciated on this one. I’m trying to implement a dynamic

  • 0

Any help would be appreciated on this one. I’m trying to implement a dynamic object wrapper over a static type. This wrapper should then allow me to call static functions dynamically at run time.

For example:

dynamic obj = new StaticDynamicWrapper(typeof(MyStaticType));
obj.DoSomething(arg1);

That’s the idea. I got some online reference to get it to work on non-generic method and property but ran into various issues when “DoSomething” is actually a generic method.

For example, if the declaration of the “DoSomething” were as follow:

public static RetType DoSomething<TArg>(this TArg arg1);

Or even worse if do something were to have an overload with the following signature…

public static RetType DoSomething<TArg>(this OtherGenericType<AnotherGenericType<TArg>> arg1);

So I need to implement the DynamicObject.TryInvokeMember in such a way that the method invokation is able to infer at runtime, based on the runtime arguments (ie. object[] args), the correct closed generic method of DoSomething. In another word I wanna be able to select the correct overload and determines the correct type arguments to call MakeGenericMethod with, all that at runtime.

The biggest roadblock so far, is figuring out how to map the method’s open generic arguments to the closed types arguments declared by the parameter arguments (ie. object[] args). Can anyone out there help me out?

Thanks for your time!

  • 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-24T04:18:15+00:00Added an answer on May 24, 2026 at 4:18 am

    The DLR will infer method overloads including generics. The open source framework ImpromptuInterface available via nuget simplifies the dlr calls to single method calls and does all the work for you. Infact it has a base class ImpromptuForwarder that will do this with a small constructor change.

    using ImpromptuInterface;
    using ImpromptuInterface.Dynamic;
    public class StaticDynamicWrapper:ImpromptuForwarder{
        public StaticDynamicWrapper(Type target):base(InvokeContext.CreateStatic(target)){
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been running in to a wall on this one...any help would be much
Been kind of stuck on this one for a while now, so any help
I would really appreciate any suggestions, no matter how simple or complex, to help
Is there an alternative to history.go(-1) for FireFox and Safari. Any Help would be
I would like to know if there are any tools that can help me
I really need help with interfaces in general... Any resources that you guys would
any help you can give is very gratefully accepted. I've been looking at this
http://localhost/XYZ/Client/(S(enlodz55ov4ncafza0gpp045))/Info/Rates.aspx Does anyway know what /(S(enlodz55ov4ncafza0gpp045))/ means? Any help appreciated.
I hope someone can help me with this one, I suspect I am doing
The problem is clear as I mentioned in the title, any help would be

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.