In C #, I have the following function definition:
public static TResult SomeParentFunctionName<TSource, TResult>(TSource SomeValue,Func<TSource, TResult> ChildFunction1, Func<TSource, TResult> ChildFunction2)
This function takes SomeValueand then calls ChildFunction1andChildFunction2
In accordance with my business rules, I should always run ChildFunction1, but only occasionally need to run ChildFunction2.
Can I make an ChildFunction2optional parameter? How should I do it? And how do I know if it has been accepted.
Parameters that I reviewed:
1) I could create two functions SomeParentFunctionName, one with ChildFunction2and one without.
2) I could pass an empty function that just doesn't do anything - but that's not a good practice.
Note: for those who want to start shouting at this question, if you cannot help, just do not.