SystemExt/Maybe{T}.cs
/// <summary>
/// Execute a function which might throw and wraps the result in an Maybe{T2}.
/// </summary>
/// <param name="func">
/// The function to wrap the result of.
/// </param>
/// <returns>
/// The result of executing <paramref name="func"/> or <see cref="None"/> if it throws an exception.
/// </returns>
Execute a function which might throw and wraps the result in an Maybe{T2}.
Execute a function which might throw and wraps the result in an Maybe { T2 } .
public static Maybe<T2> FromThrowingFunc<T2>(Func<T2> func)
        {
            try
            {
                var result = func();
                return new Maybe<T2>(result);
            }
            catch (Exception)
            {
                return Maybe<T2>.None;
            }
        }
public static Maybe < T2 > FromThrowingFunc < T2 > ( Func < T2 > func ) { try { var result = func ( ) ; return new Maybe < T2 > ( result ) ; } catch ( Exception ) { return Maybe < T2 > . None ; } }
Execute a function which might throw and wraps the result in an Maybe{T2}.
Execute a function which might throw and wraps the result in an Maybe { T2 } .
The result of executing  or  if it throws an exception.
The result of executing or if it throws an exception .
func
Func<T2>
The function to wrap the result of.
The function to wrap the result of .