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

OpenRead() private méthode

private OpenRead ( String path ) : FileStream
path String
Résultat FileStream
        public static FileStream OpenRead(String path)
        {
            return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
        }

Same methods

File::OpenRead ( string path ) : System.IO.FileStream

Usage Example

    /// <summary>
    ///     Opens a <see cref="Stream" /> to read from a file.
    /// </summary>
    /// <param name="path">The path of the file.</param>
    /// <returns>
    ///     A <see cref="Stream" /> 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 Stream OpenRead(string path)
    {
        _ = Requires.NotNullOrWhiteSpace(
            path,
            nameof(path));

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