Is Default Value - CSharp System

CSharp examples for System:Int32

Description

Is Default Value

Demo Code


using System.Globalization;
using System.Collections.Generic;
using System.Collections;
using System;/*from ww w.  j a v a 2  s .c  om*/

public class Main{
        /// <summary>
      /// 
      /// </summary>
      /// <typeparam name="U"></typeparam>
      /// <param name="value"></param>
      /// <returns></returns>
      public static bool IsDefaultValue<U> (U value) where U : IComparable<U>
      {
         //no null check required
         return default (U).CompareTo (value) == 0;
      }
}

Related Tutorials