コード例 #1
0
 /// <summary>
 /// Opens a text file, writes all the text in the file into a string asynchronously, and then closes the opened stream.
 /// The default encoding is UTF8.
 ///
 /// If the file already exists, it is overwritten.
 /// </summary>
 /// <param name="this">The <see cref="IFile"/> to read.</param>
 /// <param name="contents">The contents to write to file.</param>
 /// <returns>A string containing all text in the file.</returns>
 public static Task WriteAllTextAsync(this IFile @this, string contents) => FileExtensions.WriteAllTextAsync(@this, contents, Encoding.UTF8);
コード例 #2
0
 /// <summary>
 /// Opens a text file, reads all the text in the file into a string, and then closes the opened stream.
 /// The default encoding is UTF8.
 /// </summary>
 /// <param name="this">The <see cref="IFile"/> to read.</param>
 /// <returns>A string containing all text in the file.</returns>
 public static string ReadAllText(this IFile @this) => FileExtensions.ReadAllText(@this, Encoding.UTF8);
コード例 #3
0
 /// <summary>
 /// Opens a text file, writes all the text in the file into a string, and then closes the opened stream.
 /// The default encoding is UTF8.
 ///
 /// If the file already exists, it is overwritten.
 /// </summary>
 /// <param name="this">The <see cref="IFile"/> to read.</param>
 /// <param name="contents">The contents to write to file.</param>
 /// <returns>A string containing all text in the file.</returns>
 public static void WriteAllText(this IFile @this, string contents) => FileExtensions.WriteAllText(@this, contents, Encoding.UTF8);