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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:55:11+00:00 2026-06-03T18:55:11+00:00

I am trying to build an object that uses System.ComponentModel.ISynchronizeInvoke, which has the method:

  • 0

I am trying to build an object that uses System.ComponentModel.ISynchronizeInvoke, which has the method: (amongst others)

    public object Invoke(Delegate method, object[] args)

What is the best way to call the method with the given arguments? I can use:

    public object Invoke(Delegate method, object[] args)
    {
        return method.DynamicInvoke(args);
    }

But this is late bound. My gut instinct is that this is the only way to call the method..
Any ideas?

  • 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-03T18:55:13+00:00Added an answer on June 3, 2026 at 6:55 pm

    I think it’s logically impossible for it to be any other way. The method delegate may encapsulate a method of any signature (with any number and type of parameters, and any type of return value or void). The only way to resolve its signature and invoke it with the supplied arguments (after verifying that they’re of the correct quantity and type) would be at run-time through reflection.

    If you were not implementing the ISynchronizeInvoke interface and could define your own method, then you could restrict your method argument to only accept method delegates of a particular signature; in that case, you could invoke them directly.

    For example, to execute methods that take no parameters and have a return value, you would use:

    public TResult Invoke<TResult>(Func<TResult> method)
    {
        return method();
    }
    

    To execute a method that takes three parameters and has no return value, you would use:

    public void Invoke<T1,T2,T3>(Action<T1,T2,T3> method, T1 arg1, T2 arg2, T3 arg3)
    {
        method(arg1, arg2, arg3);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a factory method that uses the generics feature of C#.
I am trying to build a createEntity OEntity for an object that has multiple
I'm trying build a method which returns the shortest path from one node to
I'm trying to build a app that uses the SmsMessage class but there are
I want to build a method which accepts a string param, and an object
I am trying to build a core application that uses plugins so that the
I'm trying to build an ASP.net user control that uses a Repeater to iterate
I am trying to develop a system that has 2 tiers: a mobile client
I am trying to build an object of a struct but am getting a
I'm somewhat new to object oriented programming in Javascript and I'm trying to build

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.