Exemple #1
0
 /// <summary>
 /// Interprets the file as a text file
 /// </summary>
 /// <returns></returns>
 public static TextFile AsTextFile(this IFilePath path)
 => path.IsUnspecified() ? TextFile.Empty : new TextFile(path.FileSystemPath);
Exemple #2
0
 /// <summary>
 /// Reads all lines of text from the file
 /// </summary>
 /// <returns></returns>
 public static Lst <string> ReadAllLines(this IFilePath path)
 => path.IsUnspecified() ? list <string>() : Lst.make(File.ReadAllLines(path.FileSystemPath));
Exemple #3
0
 /// <summary>
 /// Presuming the represented file is a text file, reads and returns the contained text
 /// </summary>
 public static string ReadAllText(this IFilePath path, Encoding encoding)
 => path.IsUnspecified() ? String.Empty : File.ReadAllText(path.FileSystemPath, encoding);