Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net: better equiv for " " (space character)?

Tags:

.net

I am using a string builder as part of a logging process. my seperator character I am using is " ". How can I output this char in a more effective way than simply " ".

For example:

sb.Append(" ");

Or this this the acceptable way to do this?

Thanks in advance

like image 802
JL. Avatar asked Nov 30 '22 11:11

JL.


1 Answers

If you're worried that it's going to create a new string object each time, stop worrying. The compiler will optimize it to use the same string object on every call.

like image 147
Mark Byers Avatar answered Dec 21 '22 01:12

Mark Byers