I friend linked me to
this the other day and it changed how I program. It's not very often that one article changes the way I handle coding but this allowed me to clean up a lot of code. From the work in the article I have added one more function as well.
public static TResult Let(this TInput o, Func evaluator, TResult failValue)
where TResult : class
where TInput : class
{
if (o == null) return failValue;
return evaluator(o);
}
This one allows for the calling of functions that return a value.
No comments:
Post a Comment