System.Data.Common.DataStorage.IsObjectNull C# (CSharp) Méthode

IsObjectNull() public static méthode

public static IsObjectNull ( object value ) : bool
value object
Résultat bool
        public static bool IsObjectNull(object value)
        {
            return ((null == value) || (DBNull.Value == value) || IsObjectSqlNull(value));
        }

Usage Example

        public override string ConvertObjectToXml(object value)
        {
            Debug.Assert(!DataStorage.IsObjectNull(value), "we shouldn't have null here");
            Debug.Assert((value.GetType() == typeof(SqlDateTime)), "wrong input type");

            StringWriter strwriter = new StringWriter(FormatProvider);

            using (XmlTextWriter xmlTextWriter = new XmlTextWriter(strwriter))
            {
                ((IXmlSerializable)value).WriteXml(xmlTextWriter);
            }
            return(strwriter.ToString());
        }