Is it Nullable

image_pdfimage_print
   
 

//Microsoft Public License (Ms-PL)
//http://visualizer.codeplex.com/license

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Redwerb.BizArk.Core.TypeExt
{
    /// <summary>
    /// Provides extension methods for Type.
    /// </summary>
    public static class TypeExt
    {


        public static bool IsNullable(this Type type)
        {
            if (type == null) return false;
            if (!type.IsGenericType) return false;
            if (type.GetGenericTypeDefinition() != typeof(Nullable<>)) return false;
            return true;
        }
   }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.