StringBuilder exists purely for the reason that strings in .NET are immutable, that is that traditional string concatenation can use lots of resources (due to lots of String objects being created).
So, since an Int32 is also immutable why don’t classes exist for multiple addition for example?
A concatenated string gets longer, which requires heap memory allocations and memory copies.
These get more expensive the longer the string gets, ergo we’ve a helper class (i.e.
StringBuilder) to minimise the amount of copying that goes when when strings are concatenated.Ints aren’t concatinated, as you multiply ints you don’t need more memory to hold the result of two multiplied ints, you just need another int (or the same int if it’s
*=).You’d only need a helper class if you need to concatenate ints into some form of list . . . oh wait,
List<int>!