As programmers, we concatenate strings all the time. Should we worry about the performance? How about the amount of garbage we’re producing for the garbage collector? Today’s article runs a quick test to find out!
Posts Tagged concatenation
What’s the fastest way to build a string
in C#? We have several options available to us. string.Format()
is a function built right in to the string
class., Concatenation ("a" + "b"
) is a feature of the language itself! The System.Text.StringBuilder
class is a built in class with a name that makes it sound like it’s purpose-built for building strings. Today I pit these three against each other to find out just which one you should be using to build strings as quickly as possible.