mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
32 lines
681 B
C#
32 lines
681 B
C#
#nullable enable
|
|
|
|
using System;
|
|
|
|
namespace Flow.Launcher.Infrastructure
|
|
{
|
|
public static class Helper
|
|
{
|
|
/// <summary>
|
|
/// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
|
|
/// </summary>
|
|
public static T NonNull<T>(this T? obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
else
|
|
{
|
|
return obj;
|
|
}
|
|
}
|
|
|
|
public static void RequireNonNull<T>(this T obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
}
|
|
}
|