Is Nullable - CSharp System.Reflection

CSharp examples for System.Reflection:Type

Description

Is Nullable

Demo Code


using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System;//www . j  a  v a2s .  c  om

public class Main{
        public static bool IsNullable(this Type type)
        {
            return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
        }
}

Related Tutorials