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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:15:01+00:00 2026-05-22T16:15:01+00:00

I have a method to do something based on the input parameter. Now, I

  • 0

I have a method to do something based on the input parameter. Now, I want to call the method by adding to the invocation list of a delegate but with different parameters.

is it possible to do without invoking the delegate multiple times?

private delegate void myDel(int a);
private myDel del;

public MainWindow()
{
  InitializeComponent();
  del = delmethod;                
}
private void delmethod(int a)
{
 //Do something
}
private void call_methods()
{
 del(1);
 del(2); 
 del(3);
}

Is this the right way or I have any other options? Please note that , I may want to pass many parameters like this using a loop.

though I referred here, they have solution only for calling different methods but I want for the same method.

EDIT :

I want to transfer data from one
database to another by calling the
method depending on the parameter

Environment : Windows forms, .Net 3.5

  • 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-22T16:15:02+00:00Added an answer on May 22, 2026 at 4:15 pm

    by adding to the invocation list of a delegate but with different parameters.

    Possible but ugly. You end up with something like:

    del += (x) => delmethod(1);
    del += (x) => delmethod(2);
    del += (x) => delmethod(3);
    
    del(-1); // Note the -1 is not used
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something similar to the following method: public ActionResult Details(int id) { var
I do have something more specific in mind, however: Each web service method needs
Some existing web services I consume have methods that look something like this: List<Employee>
I have class method that returns a list of employees that I can iterate
I have a method that where I want to redirect the user back to
I want to dynamically open a method and return a value based on the
I have an application that sends data based on user interaction (not user input).
When using something like object.methods.sort.to_yaml I'd like to have irb interpret the \n characters
I have method in a class that I need to make sure is only
I have a method which takes params object[] such as: void Foo(params object[] items)

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.