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.
FileStream::CanSeek Property
.NET Framework (current version)
Gets a value indicating whether the current stream supports seeking.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System::Booleantrue if the stream supports seeking; false if the stream is closed or if the FileStream was constructed from an operating-system handle such as a pipe or output to the console.
The following example uses the CanSeek property to check whether a stream supports seeking.
using namespace System; using namespace System::IO; using namespace System::Text; int main() { String^ path = "c:\\temp\\MyTest.txt"; // Delete the file if it exists. if ( File::Exists( path ) ) { File::Delete( path ); } //Create the file. FileStream^ fs = File::Create( path ); try { if ( fs->CanSeek ) { Console::WriteLine( "The stream connected to {0} is seekable.", path ); } else { Console::WriteLine( "The stream connected to {0} is not seekable.", path ); } } finally { if ( fs ) delete (IDisposable^)fs; } }
Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: