Created
May 8, 2015 00:12
-
-
Save Microsofttechies/e2214563c4a4c91cdf82 to your computer and use it in GitHub Desktop.
C# Append lines to a file using a StreamWriter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| StringBuilder strBuilLog = new StringBuilder(); | |
| string strLogData = "Welcome to log data \t"; | |
| strBuilLog.Append(strLogData); | |
| string strLogData2 = "Welcome to log data 2" + Environment.NewLine; | |
| strBuilLog.Append(strLogData2); | |
| string strLogDataFinal = "Welcome to log data final \t"; | |
| strBuilLog.Append(strLogDataFinal); | |
| using (StreamWriter strwLog = new StreamWriter("c:\\log.txt")) | |
| { | |
| strwLog.Write(strBuilLog.ToString()); | |
| strwLog.Close(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment