.net - In C#, should I use string.Empty or String.Empty or "" to intitialize a string? -


in c#, want initialize string value empty string.

how should this? right way, , why?

string willi = string.empty; 

or

string willi = string.empty; 

or

string willi = ""; 

or what?

use whatever , team find readable.

other answers have suggested new string created every time use "". not true - due string interning, created either once per assembly or once per appdomain (or possibly once whole process - not sure on front). difference negligible - massively, massively insignificant.

which find more readable different matter, however. it's subjective , vary person person - suggest find out people on team like, , go consistency. find "" easier read.

the argument "" , " " mistaken each other doesn't wash me. unless you're using proportional font (and haven't worked any developers do) it's pretty easy tell difference.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -