c# - Creating an ambiguous test -


I had an idea about creating a bool isNull , where can be needed anywhere . The basic idea was as follows (pseudo-code only):

  bool isNull (var test) {if (test == null || DBNull} string.Empty) back true; Second false return; }  

But that does not work, because var is not recognized here. Instead, it is believed that var refers to a type ... well, of course, there is not one type for var !

What do I do to get around this? Or, perhaps the question I should ask, is this a good idea?

Why do not you use the object?

  bool isNull (object test) {if (test == null || test == DBNull.Value) true return; Second false return; } For   

string , I will use the string.IsNullOrEmpty method. For other types, especially when you are working this database with the database can be useful.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -