Is it Nullable : Nulllable « Data Types « C# / C Sharp






Is it Nullable

 

//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;
        }
   }
}

   
  








Related examples in the same category

1.Declare a nullable type by adding the ? type modifier in a value type declaration.
2.Nullable variable
3.Nullable bool Types
4.Nullable int Types
5.Nulllable HasValue
6.Nullable extension: Has Value And Equals