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?