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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:46:54+00:00 2026-05-16T19:46:54+00:00

Does anyone knows how can I invoke method dynamically without reflection? I`ll try to

  • 0

Does anyone knows how can I invoke method dynamically without reflection?

I`ll try to specify my question below

Suppose we have an interface IMyInterface and MyImplementation is an implementation of IMyInterface. Besides of that I have a generic proxy class MyProxy<T> where T : IMyInterface. In this proxy I wanna wrap all calls to all methods that have been defined in MyImplementation and in all inheritors of this class. The purpose I wanna achieve is the dynamic method invocation. In case of reflection everything will be transparent, but as I understand it might be quite slow. Does anyone know about solution that could be much faster?

Thanks a lot!

— update

hmm, looks like my previous descriptions was not good, so I`ll try to describe my question again. With examples 🙂

So, lets imagine that we have the following code:

public interface IMyInterface
{
     void Method();
}

public class MyImplementation : IMyInterface
{
     public void Method()
     {
          Console.WriteLine("Yeaah!");
     }
}

The important point that I forgot to mention is that we have a class named for example Holder. This class should be used by the following way

var holder = // the way of instantiation doesn`t really matters
holder.Register(myImplementationInstance);

var myInterfaceInstance = holder.Resolve<IMyInterface>();
myInterfaceInstance.Method();

Holder instance will return some wrapper that will implement IMyInterface and will wrap the real instance of myImplementation that has been registered.

As I said above we have a wrapper MyImplementationWrapper that implements IMyInterface and has the method named Method with the following body

public void Method()
{
    _wrappedInstance.Method();
}

So, there are two questions
a) How can I automatically create the wrapper for myImplementationInstance (I dont want to know anything about object that will be registred inHolder)
b) How can I dynamically invoke the methods of
myImplementationInstance` by its wrapper

  • 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-16T19:46:54+00:00Added an answer on May 16, 2026 at 7:46 pm

    First things first. Have you made sure that Reflection is not too slow for your needs? Do not go on hearsay – test it yourself.

    Edit: To include the use of dynamic

    Secondly if you are in the .net 3.5 or .net 4.0 then you can use Iron Python (or in the case of the 4.0 – any DLR language or dynamic) to do the dynamic invocation.

    The DLR is a very optimal solution for this kind of thing. In C# you can use the dynamic keyword to access the dlr

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

Sidebar

Related Questions

Have a rather simple question. Does anyone knows if i can use jparallax both
Does anyone know how can i invoke a method on the click of the
Does anyone knows where I can find tutorials and code samples, basic and advanced,
Does anyone knows how i can get buyer's reviews from a Product in a
does anyone knows any good resources and articles that can explain how to create
Why does C++ have public members that anyone can call and friend declarations that
Does anyone know how I can load a DLL without having it on each
Does anyone know I can make min-height work with the latest browsers? I am
Does anyone know how can I cut a string and then assign into an
Does anyone know how can I detect the browser type in css? What I

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.