mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
23 lines
469 B
C#
23 lines
469 B
C#
using System;
|
|
|
|
namespace Flow.Launcher.Helper;
|
|
|
|
public static class SyntaxSugars
|
|
{
|
|
public static TResult CallOrRescueDefault<TResult>(Func<TResult> callback)
|
|
{
|
|
return CallOrRescueDefault(callback, default(TResult));
|
|
}
|
|
|
|
public static TResult CallOrRescueDefault<TResult>(Func<TResult> callback, TResult def)
|
|
{
|
|
try
|
|
{
|
|
return callback();
|
|
}
|
|
catch
|
|
{
|
|
return def;
|
|
}
|
|
}
|
|
}
|