What is the difference between string.Empty and ""?Which one is best to use?
Arunava Bhattacharjee
Difference between String.Empty and “” are pretty small, but there is a difference. “” actually creates an object, it will likely be pulled out of the string intern pool, but still… while String.Empty creates no object… so if you are really looking for ultimately in memory efficiency, I suggest String.Empty.
The difference between string.Empty and "" is very small. String.empty will not create any object while "" will create a new object in the memory for the checking. Hence string.empty is better in memory management.
"" is a constant.string.empty is the best option.
String.Empty because it is a static variable, rather than "" which has to create a new string. So String.Empty is best .
String.Empty because it is a static variable, rather than "" which has to create a new string. So String.Empty is best ..........
"" is best
In .Net pre 2.0, "" creates an object while String.Empty creates no object. So it is more efficient to use String.Empty.Source of information.Length == 0 is the fastest option, but .Empty makes for slightly cleaner code.As @chadmyers mentioned, in version 2.0 and above of .Net, all occurrences of "" refer to the same string literal.So "" is pretty equivalent to .Empty, but still not as fast as .Length == 0.
Really! its very helpful for memory efficiency ..............
Exactly...nice answer :)