Sunday, May 6, 2012

.NET C# Write to a file

public static bool WriteToFile(string fileName, string fileContent)
{
    fileName = fileName;
    System.IO.TextWriter tw;
    try
    {
        tw = new System.IO.StreamWriter(fileName, true);
        tw.WriteLine(fileContent);
        tw.Close();
        return true;
    }
    catch{}
    return false;

No comments:

Post a Comment