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

String write/save in file

String save/write in file


public static bool Save(this string text, string pathWithTXTFullfilename)
        //write string to file
        System.IO.File.WriteAllText(pathWithTXTFullfilename, text);
        return true;
    catch (Exception)

    return false;


String str = "Hi...I am go to save in file";
bool isSaved = str.Save("D:\myfile.txt");

Author: Keyur Panchal

Submitted on: 11 aug 2015

Language: C#

Type: Satring, Save, Write, File, External

Views: 4055