C# StringBuilder Remove Example

In this source code example, we will demonstrate the usage of the StringBuilder Remove method in C# with an example.

The Remove method removes the specified range of characters from this instance.

C# StringBuilder Remove Example

The example deletes a few characters from a string.
using System;
using System.Text;

class StringBuilderExample {
    static void Main() {
        var sentence = "Source Code Examples  - #C All Programming Examples";
        var builder = new StringBuilder(sentence);
        builder.Remove(23, 3);
        builder.Remove(20, 1);


Source Code Examples  - All Programming Examples

Source Code Examples - All Programming Examples