This commit is contained in:
Dan Clark
2024-11-28 21:52:42 +00:00
parent a457f4d6df
commit aeff13a105
5 changed files with 95 additions and 36 deletions
+9
View File
@@ -0,0 +1,9 @@
namespace Toolkit.Foundation;
public static class TypeExtensions
{
public static Type MakeNullable(this Type type) =>
type.IsValueType && Nullable.GetUnderlyingType(type) == null
? typeof(Nullable<>).MakeGenericType(type)
: type;
}