Difference between String.Empty vs null?
String.Empty:- Represents the empty string. This field is read-only.
- The value of this field is the zero-length string, ��.
- In application code, this field is most commonly used in assignments to initialize a string variable to an empty string. To test whether the value of a string is String.Empty, use the IsNullOrEmpty method.
Null:- The null keyword is a literal that represents a null reference, one that does not refer to any object. null is the default value of reference-type variables.
- C# 2.0 introduces nullable types, which are data types that may be set to an undefined value.
No comments:
Post a Comment