Skip to main content
This is lesson 3 of 15 in this module 3/15

Example: String Allocations in Gen:0

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.

Video lesson

Want to watch this lesson?

This lesson is part of the study plan. Get instant access to all lectures, labs and practice exams.

Get the Study Plan