C# MemoryStream Position

Description

MemoryStream Position Gets or sets the current position within the stream.

Syntax

MemoryStream.Position has the following syntax.


public override long Position { get; set; }

Example


using System;/* w ww.j a v  a 2  s .  c om*/
using System.IO;
public class MainClass{
  public static void Main(String[] argv){  
    MemoryStream memStream = new MemoryStream();
    
    Console.WriteLine("Capacity = {0}, Length = {1}, Position = {2}\n",
        memStream.Capacity.ToString(),
        memStream.Length.ToString(),
        memStream.Position.ToString());
    
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




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