mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Add RequireNonNull
http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
This commit is contained in:
19
Wox.Infrastructure/SyntaxSuger.cs
Normal file
19
Wox.Infrastructure/SyntaxSuger.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Wox.Infrastructure
|
||||
{
|
||||
static class SyntaxSuger<T>
|
||||
{
|
||||
public static T RequireNonNull(T obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user