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

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -