Possible Duplicate:
What is the difference between String.Empty and “”
Hello
Simple Question;
Why
Textbox1.Text = String.Empty;
is better than
Textbox1.Text = "";
?
Possible Duplicate:
What is the difference between String.Empty and “”
Hello
Simple Question;
Why
Textbox1.Text = String.Empty;
is better than
Textbox1.Text = "";
?
It's not, really.
Basically, decide which you find to be more readable. Personally I use ""
instead of string.Empty
, but others prefer the latter.
Back in .NET 1.x days apparently there was some tiny performance difference (almost certainly irrelevant in real apps) but I believe these days even that's gone.
Use whichever you and your find most readable.
Because String.Empty is actually defined as ""
Best practices dictate not to use string literals but constants.
On a funnier note: String.Empty is/looks more Object Oriented-ISH.