Seek() public method

When overridden in a derived class, sets the position within the current stream.
The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the origin parameter.
origin SeekOrigin A value of type indicating the reference point used to obtain the new position.
return long
示例#1
0
 public void SeekTest()
 {
     PipeStream target = new PipeStream(); // TODO: Initialize to an appropriate value
     long offset = 0; // TODO: Initialize to an appropriate value
     SeekOrigin origin = new SeekOrigin(); // TODO: Initialize to an appropriate value
     long expected = 0; // TODO: Initialize to an appropriate value
     long actual;
     actual = target.Seek(offset, origin);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
示例#2
0
        public void SeekShouldThrowNotSupportedException()
        {
            const long offset = 0;
            const SeekOrigin origin = new SeekOrigin();
            var target = new PipeStream();

            try
            {
                target.Seek(offset, origin);
                Assert.Fail();
            }
            catch (NotSupportedException)
            {
            }

        }