Why use string.Empty over "" when assigning to a string object
Posted
by
dreza
on Programmers
See other posts from Programmers
or by dreza
Published on 2012-03-19T20:19:06Z
Indexed on
2012/03/19
23:38 UTC
Read the original article
Hit count: 295
I've been running StyleCop over my code and one of the recommendations SA1122 is to use string.Empty rather than "" when assigning an empty string to a value.
My question is why is this considered best practice. Or, is this considered best practice? I assume there is no compiler difference between the two statements so I can only think that it's a readability thing?
UPDATE: Thanks for the answers but it's been kindly pointed out this question has been asked many times already on SO, which in hind-sight I should have considered and searched first before asking here. Some of these especially forward links makes for interesting reading.
© Programmers or respective owner