Appends lines to a file by using a specified encoding, and then closes the file.
| C# | Visual Basic |
public static void AppendAllLines( string path, IEnumerable<string> contents, Encoding encoding )
Public Shared Sub AppendAllLines ( _ path As String, _ contents As IEnumerable(Of String), _ encoding As Encoding _ )
- path (String)
- The file to append the lines to.
- contents (IEnumerable<(Of <(<'String>)>)>)
- The lines to append to the file.
- encoding (Encoding)
- The character encoding to use.
| Exception | Condition |
|---|---|
| ArgumentException | path is a zero-length string. |
| ArgumentNullException | Either path or contents is a null reference (Nothing in Visual Basic). |
| IOException | An I/O error occurred while opening the file. |