System.IO.UnmanagedMemoryStream.UnmanagedMemoryStream.Seek C# (CSharp) Méthode

Seek() public méthode

public Seek ( long offset, SeekOrigin loc ) : long
offset long
loc SeekOrigin
Résultat long
		public override long Seek (long offset,	SeekOrigin loc)
		{
			if (closed)
				throw new ObjectDisposedException("The stream is closed");

			long refpoint;
			switch(loc) {
			case SeekOrigin.Begin:
				if (offset < 0)
					throw new IOException("An attempt was made to seek before the beginning of the stream");
				refpoint = initial_position;
				break;
			case SeekOrigin.Current:
				refpoint = current_position;
				break;
			case SeekOrigin.End:
				refpoint = length;
				break;
			default:
				throw new ArgumentException("Invalid SeekOrigin option");
			}
			refpoint += offset;
			if (refpoint < initial_position)
				throw new IOException("An attempt was made to seek before the beginning of the stream");
			current_position = refpoint;
			return(current_position);
		}