ExtensionMethod.NET Home of 837 C#, Visual Basic, F# and Javascript extension methods

AppendLine (overrride)

Adds an override to the System.Text.StringBuilder AppendLine method which takes a second parameter so can be used like AppendFormat but also creates a new line.


public static StringBuilder AppendLine(this StringBuilder sb, string format, params object[] arguments)
    string value = String.Format(format, arguments);
    return sb;


StringBuilder myStringBuilder = new StringBuilder();
myStringBuilder.AppendLine("This is the first line");
myStringBuilder.AppendLine("This is the {0} line", "second");

Author: Robin Norton

Submitted on: 19 mei 2015

Language: C#

Type: System.Text.StringBuilder

Views: 3582