Description of dbnull, null, "", and string. Empty in C #
1. dbnull
This class is used to indicate that no known value exists (usually used in database applications ).Program).
In database applications, empty objects are valid values of fields. This class distinguishes between null values (empty objects) and uninitialized values (dbnull. Value instances ). For example, a table can contain records with uninitialized fields. By default, these uninitialized fields have dbnull values.
Dbnull is never equal to any value.
Dbnull is a separate class, which means that the class can only have one instance. The unique instance is dbnull. value.
For data-intensive applications that access SQL databases, the system. Data. sqltypes class must be used. These classes have inherent support for null values.
2. null
The null keyword is a text value that does not reference any object's null reference. Null is the default value of the reference type variable. Then, only the referenced variable can be null. If int I = NULL, it is not possible because Int Is of the value type.
Null is used to determine the reference invalidate.
3. "And string. Empty
Both of these are empty strings, with a focus on the difference between string str1 = "" and string str2 = NULL. After this definition, str1 is an empty string, A null string is a special string, except that the value of this string is null and has an accurate point in memory. String str2 = NULL. After this definition, only a string class reference is defined. str2 does not point to any place. If it is not instantiated before use, an error is returned.