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

后端 未结 7 1106
悲哀的现实
悲哀的现实 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:26

    It sounds like what you want to do is this:

    object obj = null;
    double d;
    
    if (!double.TryParse(Convert.ToString(obj), out d))
    {
       d = 0.0;
    }
    

    But the question does not make a lot of sense.

提交回复
热议问题