Flow.Launcher/Flow.Launcher.Infrastructure/Helper.cs

33 lines
681 B
C#
Raw Permalink Normal View History

2023-01-07 19:11:43 +00:00
#nullable enable
using System;
2020-04-21 09:12:17 +00:00
namespace Flow.Launcher.Infrastructure
{
2016-05-07 18:16:13 +00:00
public static class Helper
{
/// <summary>
/// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
/// </summary>
2023-01-07 19:11:43 +00:00
public static T NonNull<T>(this T? obj)
{
if (obj == null)
{
throw new NullReferenceException();
}
else
{
return obj;
}
}
2016-05-07 18:16:13 +00:00
public static void RequireNonNull<T>(this T obj)
{
if (obj == null)
{
throw new NullReferenceException();
}
}
}
}