Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In many articles I have got this point to improve performance of asp.net application - use string.Empty instead of strString=""
What is the problem in using strString=""? And how string.Empty improves the performance?
Posted
Updated 6-Sep-10 3:17am
v2

By making a string = "" you are discarding any value within the string, assigning a value to that string (even though that value is a null), and causing it to look for exceptions.

String.Empty does not look for exceptions and merely discards any extant value, it does not assign a value thereafter.

It is much quicker.
 
Share this answer
 
Then you have not read the articles properly. Most of the articles describe the reason as well.

A simple Google search will also tell you the answer.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900