mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 12:08:37 +08:00
26 lines
430 B
C#
26 lines
430 B
C#
|
|
using System;
|
|
|
|
namespace mRemoteNG.Tools
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static Maybe<T> Maybe<T>(this T value)
|
|
{
|
|
return new Maybe<T>(value);
|
|
}
|
|
|
|
public static Maybe<U> MaybeParse<T, U>(this T value, Func<T, U> parseFunc)
|
|
{
|
|
try
|
|
{
|
|
return new Maybe<U>(parseFunc(value));
|
|
}
|
|
catch
|
|
{
|
|
return new Maybe<U>();
|
|
}
|
|
}
|
|
}
|
|
}
|