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

  • Home
  • SEARCH
  • 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 3356268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:29:39+00:00 2026-05-18T02:29:39+00:00

Does anyone know how the source code is declared for the Func and Action

  • 0

Does anyone know how the source code is declared for the Func and Action pointers? I’m trying to understand the theory behind making an asynchronous call using delegates and how that is tied to threading.

For example, if I have the code below:

    static void Main()
{
  Func<string, int> method = Work;
  IAsyncResult cookie = method.BeginInvoke ("test", null, null);
  //
  // ... here's where we can do other work in parallel...
  //
  int result = method.EndInvoke (cookie);
  Console.WriteLine ("String length is: " + result);
}

static int Work (string s) { return s.Length; }

How would I use the ‘delegate’ type to replace the Func<> structure; the reason I’d like to figure it out is because Func can only take an input and a return variable. It doesn’t allow for design flexibility in the method that it’s pointing to.

Thanks!

  • 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-18T02:29:40+00:00Added an answer on May 18, 2026 at 2:29 am

    Func<int, string> is just a generic delegate. It just helps you avoid writing common delegates. That’s it. If it doesn’t fit for you should write your own delagate.
    the delagate to replace the one you are asking is

    delegate string Method(int parm);
    

    if you want a func(for istance) that takes 22 🙂 integer and return a string you have to write you own delegate

    delegate string CrazyMethod(int parm1,int parm2,.....)
    

    In your case

     delegate int MyOwnDeletage(string d);
        class Program
        {
    
            static int Work(string s) { return s.Length; }
    
            static void Main(string[] args)
            {
    
                //  Func<string, int> method = Work; 
                MyOwnDeletage method =Work;
    
                  IAsyncResult cookie = method.BeginInvoke ("test", null, null); 
                  // 
                  // ... here's where we can do other work in parallel... 
                  // 
                  int result = method.EndInvoke (cookie); 
                  Console.WriteLine ("String length is: " + result); 
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of source code to a free bar code reader algorithm, ideally
Does anyone know anywhere there's a wide collection of Python source code on the
Does anyone know of source code, ideally in C# or similar, for reading .DXF
Does anyone know of any packages or source code that does simple statistical analysis,
Does anyone know of a good and simple open source code snippet repository? Ive
does anyone know where I could find the source code for the SandPile (cellular
Does anyone know of a tool to analyze/navigate VB6 source code like the tool
Does anyone know where I can find open source code (in c++) that converts
Does anyone know what approach one can take to automatically generate Java source code,
Does anyone know if the MS Sync Framework source code is available and how

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.