WriteAllLines()

File::WriteAllLines(const String&, const SharedPtr<Collections::Generic::IEnumerable<String>>&, const EncodingPtr&) method

Creates a new text file or overwrites the existing one and writes all strings from the specified enumerable collection of strings to it, each string on a new line, using the specified encoding.

static void System::IO::File::WriteAllLines(const String &path, const SharedPtr<Collections::Generic::IEnumerable<String>> &contents, const EncodingPtr &encoding=Text::Encoding::get_UTF8Unmarked())

Arguments

ParameterTypeDescription
pathconst String&The file to create or overwrite
contentsconst SharedPtr<Collections::Generic::IEnumerable<String>>&An enumerable collection of strings
encodingconst EncodingPtr&The character encoding to use

File::WriteAllLines(const String&, const ArrayPtr<String>&, const EncodingPtr&) method

Creates a new text file or overwrites the existing one and writes all strings from the specified array of strings to it, each string on a new line, using the specified encoding.

static void System::IO::File::WriteAllLines(const String &path, const ArrayPtr<String> &contents, const EncodingPtr &encoding=Text::Encoding::get_UTF8Unmarked())

Arguments

ParameterTypeDescription
pathconst String&The file to create or overwrite
contentsconst ArrayPtr<String>&A string array
encodingconst EncodingPtr&The character encoding to use

See Also