-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed as not planned
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.IO
Description
Background and motivation
Currently getting the size of a file requires creating a new instance of the FileInfo class and calling the Length instance method. This is clunky. A GetLength static method will be easier to use and pair nicely with existing Get(...) methods on System.IO.File.
API Proposal
namespace System.IO;
public static class File
{
public static long GetLength(string path);
public static long GetLength(SafeFileHandle fileHandle);
}API Usage
// Fancy the value
var FileSize = Syste.IO.File.GetLength($@"C:\Text.txt");Alternative Designs
Continue using FileInfo
Risks
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.IO