StringBuilder

noun

say it: “STRING-bil-der” /ˈstrɪŋbɪldər/

A C# class for building up a long piece of text bit by bit, faster than adding strings together.

What is StringBuilder in C#?

StringBuilder — A class for efficiently building or changing a sequence of characters.

using System.Text;

class MessageBuilder
{
    string Build()
    {
        StringBuilder message = new("Order");
        message.Append(" ready");
        return message.ToString();
    }
}

In a sentence

  • “I built the receipt with a StringBuilder, one Append per line.”

Level: Apprentice · More C# terms at this level

Updated

In other subjects