---
title: "StringBuilder class in c#"  
description: "StringBuilder class is the part of the C# string in the category of mutable string and it’s provide like a mutable strings (dynamically add the more c"  
author: "Amit Singh"  
published: 2011-01-18  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/99/stringbuilder-class-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# StringBuilder class in c#

[StringBuilder](https://www.mindstick.com/forum/34632/string-vs-stringbuilder-vs-stringbuffer-in-java) class is the part of the C# string in the category of mutable string and it’s provide like a mutable strings (dynamically add the more [character](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in given string). Mutable strings are also known [as dynamic](https://www.mindstick.com/forum/12679/change-event-not-work-as-dynamic-as-expected) strings.\

StringBuilder class provides a many [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) which are used to manipulate the strings dynamically.

##### \
There are some important methods related to StringBuilder class as

\

1. Append() : which are used for an append a string

2. AppendFormat(): which are used for an append a strings using a specific format

3. Insert(): which are used for inserts a string at a specified position

4. Remove(): which are used for removes the specified characters.

5. Replace(): Replaces all [instances](https://answers.mindstick.com/qa/92508/how-can-you-hide-the-sql-server-instances) of a character with a specified one.

6. EnsureCapacity():it check the sufficient size. Etc.

##### And properties of its

[Capacity](https://www.mindstick.com/interview/832/what-is-the-difference-between-the-size-and-capacity-of-a-vector), Length, MaxCapacity etc.

How create the StringBuilder class

· StringBuilder strName=new StringBuilder()

Where strName is [created as](https://answers.mindstick.com/qa/37901/nagaland-was-created-as-a-separate-state-in-which-year) an [empty string](https://www.mindstick.com/forum/12697/json-stringify-is-sending-empty-string).

· StringBuilder strName=new StringBuilder(“India”);

Where strName is created with a string “india”.

**Note**: The System.Text [namespace](https://www.mindstick.com/articles/12552/namespace) contains the StringBuilder class.

---

Original Source: https://www.mindstick.com/blog/99/stringbuilder-class-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
