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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:24:11+00:00 2026-06-04T17:24:11+00:00

as you can see in my code, I want to hold( set ) a

  • 0

as you can see in my code, I want to hold( set ) a method into an object.
And call the method with that object…

Please take look at the code, you can understand easly;
it’s hard to explain in plain English…

My question is; Ofcourse “Action operation” object can’t hold the method that will be called.

So, how can I solve this problem? What can I do?


...
    enum CampaignUserChoice
    {
        Insert,
        Update,
        Delete,
        Disable
    }

private void AskUserAboutCampaignOperation(CampaignUserChoice choice) { string questionForUser = string.Empty; string questionTitleForUser = string.Empty; Action operation; //<<<<--------------------- this line, it's method holder if (choice == CampaignUserChoice.Insert) { questionForUser = "Do you want to create a new campaign?"; questionTitleForUser = "NEW CAMPAIGN"; operation = InsertCampaign(TakeDatasFromGui()); //<---------- set which method you want to call } else { operation = UpdateCampaign( campaignId, TakeDatasFromGui()); } //TODO write other elses... switch (MessageBox.Show(questionForUser, questionTitleForUser, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Yes: operation; //<<<------------------ call method here... break; case DialogResult.No: // "No" processing break; case DialogResult.Cancel: // "Cancel" processing break; } }

Thank you very much for all answers…

  • 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-04T17:24:13+00:00Added an answer on June 4, 2026 at 5:24 pm

    You’re trying to use delegates:

    operation = TakeDataFromGui;
    ...
    operation();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want see the source code of System.Web.Routing.RouteValueDictionary class. But Reflector can't disassemble it
I have some code that is using SyncEnumerator. As you can see here ,
I want to make a class that can hold settings for my app. Its
I want to create an integer custom field on an object. I see that
In my other question You can see code of my arr structure and PriorityQueue
For some reason my bind events won't work. You can see my code here:
in this question I posted you can see the originating code sample for this
There is code for save button, but I can't see any code behind the
I have some really funky code. As you can see from the code below
How can I see the assembly code for a C++ program? What are the

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.