using System.IO; FileStream fs = new FileStream("example.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); fs.Seek(0, SeekOrigin.End);
using System.IO; FileStream fs = new FileStream("example.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); fs.Seek(500, SeekOrigin.Begin);Here, we create a FileStream instance for a file named "example.txt" with read and write access. We then use the Seek() method to move the file pointer to 500 bytes from the beginning of the file with the SeekOrigin.Begin argument. Package library: System.IO.FileSystem.