System.IO.File.OpenText C# (CSharp) Méthode

OpenText() public static méthode

public static OpenText ( String path ) : StreamReader
path String
Résultat StreamReader
        public static StreamReader OpenText(String path)
        {
            if (path == null)
                throw new ArgumentNullException(nameof(path));
            Contract.EndContractBlock();

            return new StreamReader(path);
        }

Same methods

File::OpenText ( string path ) : System.IO.StreamReader

Usage Example

    /// <summary>
    ///     Opens a <see cref="StreamReader" /> to read text from a file.
    /// </summary>
    /// <param name="path">The path of the file.</param>
    /// <returns>
    ///     A <see cref="StreamReader" /> that can read from a file.
    /// </returns>
    /// <exception cref="ArgumentNullException">
    ///     <paramref name="path" /> is <see langword="null" /> (<see langword="Nothing" /> in Visual Basic).
    /// </exception>
    public StreamReader OpenText(string path)
    {
        _ = Requires.NotNullOrWhiteSpace(
            path,
            nameof(path));

        return(FSFile.OpenText(path));
    }
All Usage Examples Of System.IO.File::OpenText