Catnap.Extensions.TypeExtensions.GetUnderlyingGenericType C# (CSharp) Méthode

GetUnderlyingGenericType() public static méthode

public static GetUnderlyingGenericType ( this type ) : Type
type this
Résultat System.Type
        public static Type GetUnderlyingGenericType(this Type type)
        {
            if (!type.IsGenericType)
            {
                return type;
            }
            var genericType = type.GetGenericTypeDefinition();
            return genericType.Equals(typeof(Nullable<>))
                ? type.GetGenericArguments()[0]
                : type;
        }