C# String.Substring equivalent for StringBuilder?

The StringBuilder class has a special version of the ToString method that takes two arguments, exactly as Substring(startIndex, length).

 StringBuilder sb = new StringBuilder("This is a Test");
 string test = sb.ToString(10, 4);
 Console.WriteLine(test);   // result = Test

Leave a Comment

tech