Skip to main content
This is lesson 3 of 15 in this module Course 64% complete

Example: String Allocations in Gen:0

Premium Content

Sign in with your account or sign up to access this lesson.

We show a common coding mistake where integers and constants are converted to strings before being fed into a StringBuilder, generating thousands of unnecessary short-lived string objects per loop. The lesson demonstrates the correct approach of using strongly-typed Append overload, and chaining multiple calls together instead of using the + operator.