SubSonic.Extensions.CreateToFile


Contents

Summary

Creates or opens a file for writing and writes text to it.

Namespace

SubSonic.Extensions.IO

Example

"Lorem Ipsem My Test to Save".CreateToFile(@"C:\MyFile.txt");

Unit Test

public void CreateToFile_Should_SaveText_To_File() {
    //sorry for this test
    "this is a stupid test".CreateToFile("C:\\testfile2.txt");
    //it's the only way I can think of to do it
    Assert.Equal("C:\\testfile2.txt".GetFileText(), "this is a stupid test");
}

Comments

SubSonic 3.0 implements this as an extension on System.String - 2.x uses a static method on SubSonic.Sugar.Files.