Are these tests for Nullable Type equivalent?

From MSDN for Nullable.GetUnderlyingType Method:

The type argument of the nullableType parameter, if the nullableType parameter is a closed generic nullable type; otherwise, null.

So, yes it is safe to use the former version.

Decompiled from GetUnderlyingType:

public static Type GetUnderlyingType(Type nullableType)
{
  if (nullableType == null)
    throw new ArgumentNullException("nullableType");
  Type type = (Type) null;
  if (nullableType.IsGenericType && !nullableType.IsGenericTypeDefinition && nullableType.GetGenericTypeDefinition() == typeof (Nullable<>))
    type = nullableType.GetGenericArguments()[0];
  return type;
}

Tags:

C#

Nullable