Apply a function

public static B Apply<A, B>(this A a, System.Func<A, B> f)
{
  return f(a);
}
Example:
"Hello".Apply(System.String.IsNullOrWhiteSpace); // = false
"3".Apply(System.Int32.Parse);                   // = 3 (Int32)

Description

applies a function to the given value - best used with static methods

Details

Double click on the code to select all.

 

;