Renci.SshNet.SftpClient.WriteAllLines C# (CSharp) 메소드

WriteAllLines() 공개 메소드

Writes the specified string array to the file by using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, string contents, Encoding encoding ) : void
path string The file to write to.
contents string The string array to write to the file.
encoding Encoding An object that represents the character encoding applied to the string array.
리턴 void
        public void WriteAllLines(string path, string[] contents, Encoding encoding)
        {
            using (var stream = CreateText(path, encoding))
            {
                foreach (var line in contents)
                {
                    stream.WriteLine(line);
                }
            }
        }

Same methods

SftpClient::WriteAllLines ( string path, IEnumerable contents ) : void
SftpClient::WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void
SftpClient::WriteAllLines ( string path, string contents ) : void