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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:05:35+00:00 2026-06-12T06:05:35+00:00

I acknowledge that they can be useful, but I’m trying to wrap my head

  • 0

I acknowledge that they can be useful, but I’m trying to wrap my head around when I would actually want to have a func as a parameter of a method.

public void WeirdMethod(int myNumber, func op);

In terms of design and functionality, could someone explain to me some circumstances where I would want to consider this? Theories of “reusability” isn’t going going to help me much. Real world scenarios would be best. Help me think like you lol.

Here’s about all I know:

  • This would allow me to pass a delegate
  • This would allow me to use a lambda expression.

Yeap…

NOTE:
I know this thread will get closed since there’s no “right” answer. But I think what clicked it for me just now was “delayed calculation”.

  • 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-12T06:05:36+00:00Added an answer on June 12, 2026 at 6:05 am

    A general scenario is when you must pass a delayed calculation to your method. This is useful when calculating something is expensive, for example, when you cache something.

    public Guid GetFromCache(string key, Func<Guid> make) {
        Guid res;
        if (!cache.TryGetValue(key, out res)) {
            res = make();
            cache.Add(key, res);
        }
        return res;
    }
    

    Now you can call this method as follows:

    Guid guid = GetFromCache(myKey, () => database.MakeNewGuid());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First let me acknowledge that I'm in way over my head. Our church website
Say I have the text abcabx. I would like to know that there is
I have a custom user control that fires an exception when trying to add
I have an idea for a language feature: In C#, it would be useful
I have an exit page that informs users that they are leaving my site.
I have some very small classes that I feel should be pulled up but
I acknowledge this question as broad and vague, but I would like to know
EDIT: I have submitted a bug report and Microsoft have acknowledge that it is
I have inherited a piece of SQL that I am working on for a
I have an application that needs to render about 100 flash graphs (as well

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.