Quicky StringBuilder Tip

StringBuilder has an Append method that returns a reference to itself. This is useful for when you want to append several items in one go. The following code is an example. Obviously, you’ll get more benefit the more items you add:

 StringBuilder sb = new StringBuilder( ) ;  
string s = sb.Append( @”Hello ” )
.Append( @”World” )
.ToString( ) ;

🙏🙏🙏

Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please ping me on Twitter.

Leave a comment

Comments are moderated, so there may be a short delays before you see it.

Published