mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-21 17:13:09 +08:00
V1.2 新构架
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace System
|
||||
{
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
public static T ThrowIsNull<T>(this T? t, string parameterName) where T : class
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
throw new ArgumentNullException(parameterName);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public static T ThrowIsNull<T>(this T? t, string parameterName) where T : struct
|
||||
{
|
||||
if (!t.HasValue)
|
||||
{
|
||||
throw new ArgumentNullException(parameterName);
|
||||
}
|
||||
return t.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user