C# MemoryStream Seek
Description
MemoryStream Seek
Sets the position within the current
stream to the specified value.
Syntax
MemoryStream.Seek
has the following syntax.
public override long Seek(
long offset,
SeekOrigin loc
)
Parameters
MemoryStream.Seek
has the following parameters.
offset
- The new position within the stream. This is relative to the loc parameter, and can be positive or negative.loc
- A value of type SeekOrigin, which acts as the seek reference point.
Returns
MemoryStream.Seek
method returns The new position within the stream, calculated by combining the initial
reference point and the offset.
Example
Set the position to the beginning of the stream.
using System.IO;// ww w. j av a2 s . c om
using System;
public class MainClass{
public static void Main(String[] argv){
MemoryStream memStream = new MemoryStream();
memStream.Seek(0, SeekOrigin.Begin);
}
}