Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
AnswerRe: string.Empty Vs "" [modified] Pin
Paw Jershauge27-Jun-08 0:10
Paw Jershauge27-Jun-08 0:10 
GeneralRe: string.Empty Vs "" Pin
Abhijit Jana27-Jun-08 0:40
professionalAbhijit Jana27-Jun-08 0:40 
GeneralRe: string.Empty Vs "" Pin
Guffa27-Jun-08 1:20
Guffa27-Jun-08 1:20 
GeneralRe: string.Empty Vs "" Pin
S. Senthil Kumar27-Jun-08 4:39
S. Senthil Kumar27-Jun-08 4:39 
AnswerRe: string.Empty Vs "" Pin
Christian Graus27-Jun-08 0:23
protectorChristian Graus27-Jun-08 0:23 
GeneralRe: string.Empty Vs "" Pin
N a v a n e e t h27-Jun-08 0:40
N a v a n e e t h27-Jun-08 0:40 
GeneralRe: string.Empty Vs "" Pin
Guffa27-Jun-08 1:31
Guffa27-Jun-08 1:31 
AnswerRe: string.Empty Vs "" Pin
Guffa27-Jun-08 1:43
Guffa27-Jun-08 1:43 
As the string.Empty property returns a reference to an empty string literal that already exist in the mscorlib assembly, you don't have to create another literal string in your assembly. Other than that there is no difference in the generated code, they both use a literal string that already exists.

The most relevant reason I have found, though, is that the code gets clearer. If you always use string.Empty when you want an empty string, it's obvious what your intention was. If you then see "" in the code you know that the contents of the string was accidentally removed or left out.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: string.Empty Vs "" Pin
Pete O'Hanlon27-Jun-08 1:53
mvePete O'Hanlon27-Jun-08 1:53 
GeneralRe: string.Empty Vs "" Pin
Mark Churchill27-Jun-08 16:39
Mark Churchill27-Jun-08 16:39 
AnswerRe: string.Empty Vs "" Pin
Jamal Mavadat27-Jun-08 5:34
Jamal Mavadat27-Jun-08 5:34 
Questionscalar variable Pin
j_tush26-Jun-08 23:52
j_tush26-Jun-08 23:52 
AnswerRe: scalar variable Pin
Christian Graus27-Jun-08 0:25
protectorChristian Graus27-Jun-08 0:25 
QuestionNeed help with an regular expression Pin
Paw Jershauge26-Jun-08 23:43
Paw Jershauge26-Jun-08 23:43 
AnswerRe: Need help with an regular expression Pin
Vimalsoft(Pty) Ltd27-Jun-08 0:59
professionalVimalsoft(Pty) Ltd27-Jun-08 0:59 
GeneralRe: Need help with an regular expression Pin
Paw Jershauge27-Jun-08 1:07
Paw Jershauge27-Jun-08 1:07 
AnswerRe: Need help with an regular expression Pin
Paw Jershauge27-Jun-08 1:58
Paw Jershauge27-Jun-08 1:58 
AnswerRe: Need help with an regular expression Pin
User 665827-Jun-08 4:19
User 665827-Jun-08 4:19 
GeneralRe: Need help with an regular expression Pin
Paw Jershauge28-Jun-08 3:22
Paw Jershauge28-Jun-08 3:22 
GeneralRe: Need help with an regular expression Pin
User 665828-Jun-08 3:31
User 665828-Jun-08 3:31 
GeneralRe: Need help with an regular expression Pin
Paw Jershauge30-Jun-08 8:47
Paw Jershauge30-Jun-08 8:47 
Questionarray string using dynamically Pin
maruthi26-Jun-08 23:24
maruthi26-Jun-08 23:24 
AnswerRe: array string using dynamically Pin
Guffa26-Jun-08 23:36
Guffa26-Jun-08 23:36 
GeneralRe: array string using dynamically Pin
maruthi26-Jun-08 23:56
maruthi26-Jun-08 23:56 
AnswerRe: array string using dynamically Pin
dan!sh 26-Jun-08 23:38
professional dan!sh 26-Jun-08 23:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.