Skip to content

Use FileOptions.SequentialScan in File.ReadAllBytes #40001

@mcpiroman

Description

@mcpiroman

System.IO.File.ReadAllBytesAsync already uses FileOptions.SequentialScan flag when opening a file, but System.IO.File.Read does not:

using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 1))

Furthermore, this could be added in ReadAllText and alike, but it would need to be routed through StreamReader and that would probably require public API changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.IOgood first issueIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributorstenet-performancePerformance related issueuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions