How to check object is null or empty in C#.NET 3.5?

后端 未结 7 1078
悲哀的现实
悲哀的现实 2021-02-15 18:26

If objects contains null or empty then how to validate or check the condition for the same?

How to bool check whether object obj is null or

7条回答
  •  迷失自我
    2021-02-15 19:22

    class Program
    {
        static void Main(string[] args)
        {
            object obj = DBNull.Value;
            if(obj != DBNull.Value) {
                double d = Convert.ToDouble(obj);
                Console.WriteLine(d.ToString());
            }
        }
    }
    

提交回复
热议问题