In C#, should I use string.Empty or String.Empty or "" to intitialize a string?
.net, c#, initialization, string
Solution
Use whatever you and your team find the most readable.
Other answers have suggested that a new string is created every time you use `""`. This is not true - due to string interning, it will be created either once per assembly or once per AppDomain (or possibly once for the whole process - not sure on that front). This difference is negligible - massively, massively insignificant.
Which you find more readable is a different matter, however. It's subjective and will vary from person to person - so I suggest you find out what most people on your team like, and all go with that for consistency. Personally I find `""` easier to read.
The argument that `""` and `" "` are easily mistaken for each other doesn't really wash with me. Unless you're using a proportional font (and I haven't worked with any developers who do) it's pretty easy to tell the difference.
Problem
In C#, I want to initialize a string value with an empty string. How should I do this? What is the right way, and why? ``` string willi = string.Empty; ``` or ``` string willi = String.Empty; ``` or ``` string willi = ""; ``` or what?