Object - IsDBNull
A T extension method to determines whether the object is not equal to any of the provided values.
public static void Main() { object thisDBNull = DBNull.Value; object thisNull = null; // C# Extension Method: Object - IsDBNull bool result1 = thisDBNull.IsDBNull(); // return true; bool result2 = thisNull.IsDBNull(); // return false; Console.WriteLine(result1); Console.WriteLine(result2); }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns an indication whether the specified object is of type . /// </summary> /// <typeparam name="T">Generic type parameter.</typeparam> /// <param name="value">An object.</param> /// <returns>true if is of type ; otherwise, false.</returns> public static Boolean IsDBNull<T>(this T value) where T : class { return Convert.IsDBNull(value); } }