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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:37:25+00:00 2026-05-22T15:37:25+00:00

I admit that this question is subjective but I am interested in the view

  • 0

I admit that this question is subjective but I am interested in the view of the community. I have a cache class that takes a cache loader function of type Func<TResult>, which it uses to retrieve a value from the database and store it in cache.

public static class Cache
{
    public TResult Get<TResult>(string cacheKey, Func<TResult> cacheLoader) 
    {
        // Implementation
    }
}

My question is: How should I name the function parameter?

  • Should I name it like an object, e.g. cacheLoader?
  • Should I name it like a method, e.g. loadResult?
  • Should I explicitly refer to it as a function, e.g. cacheLoadFunction? (I don’t like this.)

I’m less interested in what I should name this particular function parameter and more interested in how you name function parameters in general. What say ye, Stack Overflow community?

  • 1 1 Answer
  • 3 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-22T15:37:26+00:00Added an answer on May 22, 2026 at 3:37 pm

    There are precedents for using a noun in the Framework, e.g.

    Enumerable.Average<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
    
    Enumerable.Count<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
    
    Enumerable.GroupBy<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
    
    ConcurrentDictionary<TKey,TValue>.GetOrAdd(TKey key, 
                Func<TKey, TValue> valueFactory);
    

    The noun is often an appropriate verb with an agentive suffix.

    In your example I would use something like loader or possibly valueFactory. I personally don’t like cacheLoader because presumably it’s the caller rather than the delegate that does the work of inserting in the cache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple script that I'm working on. I must admit, I'm totally
I am asking this question from an architectural point of view. I have been
I admit...I am posting this question because I still don't have an answer to
I will have to admit the title of this question sucks... I couldn't get
I'll preface this question with the note that I have looked at this similar
I have to admit that having not even tried to code this myself this
I've posted this question in gis.stackexchange earlier but I'm not sure if that was
This is neither a code-question nor technical issue, so I admit that it can
I do admit this question is going to be a bit vague, but I
I admit this is a homework question that asks if this is possible. I

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.