About 13,000 results
Open links in new tab
  1. StreamWriter.WriteLine Method (System.IO) | Microsoft Learn

    Writes a formatted string and a new line to the stream, using the same semantics as the Format (String, Object, Object) method.

  2. Append lines to a file using a StreamWriter - Stack Overflow

    Sep 5, 2011 · Use this StreamWriter constructor with 2nd parameter - true. Another option is using System.IO.File.AppendText.

  3. C# - File Handling - Dot Net Perls

    Aug 9, 2025 · Opening files in C# involves types from the System.IO namespace. Methods like File.ReadAllText can easily read in a file. Often loops are not even needed. Writing to files can be …

  4. C# : WriteLine Method - CodeBottle

    using System.IO; using System; class WriteFile { staticvoid Main () { // Writes file with StreamWriter. string fileLoc = "D://MyFile.txt"; FileStream fs = new FileStream (fileLoc, FileMode.Create); // Creates …

  5. TextWriter.WriteLine Method (System.IO) | Microsoft Learn

    This method does not search the specified string for individual newline characters (hexadecimal 0x000a) and replace them with NewLine. If a specified object is not referenced in the format string, it is ignored.

  6. C# StreamWriter - Writing Text Files in C# - ZetCode

    Apr 20, 2025 · Learn how to use the C# StreamWriter class to efficiently write text data to files. This tutorial includes detailed explanations, practical examples, and tips for file I/O operations in C# …

  7. C# Language Tutorial => Writing lines to a file using the...

    Learn C# Language - Writing lines to a file using the System.IO.StreamWriter class

  8. C# - StreamWriter Examples - Dot Net Perls

    Aug 11, 2025 · We first declare and initialize a StreamWriter instance in a using -construct. Please note how the System.IO namespace is included at the top of the file. Important The using -keyword …

  9. C# StreamWriter Example

    The method returns a Task that represents the asynchronous write operation. The following code snippet creates and writes a new line for each char to the stream.

  10. c# - StreamWriter: How to add a new line? - Stack Overflow

    2 I want to write a string into a file. My problem is that I cannot add new lines into the file.