FileStream.Length Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the length in bytes of the stream.
public:
virtual property long Length { long get(); };
public override long Length { get; }
member this.Length : int64
Public Overrides ReadOnly Property Length As Long
Property Value
A long value representing the length of the stream in bytes.
Exceptions
CanSeek for this stream is false
.
An I/O error, such as the file being closed, occurred.
Examples
The following example uses the Length
and Position
properties to check for an end-of-file condition.
if ( s->Length == s->Position )
{
Console::WriteLine( "End of file has been reached." );
}
if( s.Length==s.Position )
{
Console.WriteLine("End of file has been reached.");
}
if s.Length = s.Position then
printfn "End of file has been reached."
If s.Length = s.Position Then
Console.WriteLine("End of file has been reached.")
End If
Remarks
For a list of common file and directory operations, see Common I/O Tasks.
Applies to
See also
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.