C# FileStream Position

Description

FileStream Position Gets or sets the current position of this stream.

Syntax

FileStream.Position has the following syntax.


public override long Position { get; set; }

Example

Gets or sets the current position of this stream.


/*from ww  w. ja  v a2s  .com*/

using System;
using System.IO;

class TestRW 
{
    public static void Main(String[] args)
    {
        FileStream s = new FileStream("MyFile.txt", FileMode.OpenOrCreate, FileAccess.Read);
        if( s.Length==s.Position )
        {
           Console.WriteLine("End of file has been reached.");
        }
    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter