FileInfo.Length Property

July 28, 2014

Gets the size, in bytes, of the current file.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

public long Length { get; }

Property Value

Type: System.Int64
The size of the current file in bytes.

ExceptionCondition
IOException

Refresh cannot update the state of the file or directory.

FileNotFoundException

The file does not exist.

-or-

The Length property is called for a directory.

The value of the Length property is pre-cached if the current instance of the FileInfo object was returned from any of the following DirectoryInfomethods:

To get the latest value, call the Refresh method.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft