Checking if Type instance is a nullable enum in C#
c#, enums, nullable
Solution
public static bool IsNullableEnum(this Type t)
{
Type u = Nullable.GetUnderlyingType(t);
return (u != null) && u.IsEnum;
}
Problem
How do i check if a Type is a nullable enum in C# something like ``` Type t = GetMyType(); bool isEnum = t.IsEnum; //Type member bool isNullableEnum = t.IsNullableEnum(); How to implement this extension method? ```