The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FileInfo.Length Property


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

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

member Length : int64 with get

Property Value

Type: System.Int64

The size of the current file in bytes.

Exception Condition

Refresh cannot update the state of the file or directory.


The file does not exist.


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.

The following example displays the size of the specified files.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2015 Microsoft