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

CopyToFile

Writes the specified StringBuilder to the file using the specified path. If the file already exists, it is overwritten.

Source

public static class StringBuilderHelper
{
  public static void CopyToFile(this StringBuilder sBuilder, string path)
  {
    File.WriteAllText(path, sBuilder.ToString());
  }
}

Example

new StringBuilder("Hello World!!!").CopyToFile(@"c:\helloworld.txt");

Author: Érico Luis Barrientos Leite

Submitted on: 5 feb 2012

Language: C#

Type: System.Text.StringBuilder

Views: 5062