Created
May 8, 2017 09:33
-
-
Save davidfowl/272e9f0f28ee10102d4113d212fc4672 to your computer and use it in GitHub Desktop.
Stream throws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
namespace ConsoleApp19 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var ms = new MemoryStream(); | |
var source = new MyStream(); | |
source.CopyTo(ms); | |
} | |
} | |
public class MyStream : Stream | |
{ | |
public override bool CanRead => false; | |
public override bool CanSeek => false; | |
public override bool CanWrite => true; | |
public override long Length => 0; | |
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } | |
public override void Flush() | |
{ | |
} | |
public override int Read(byte[] buffer, int offset, int count) | |
{ | |
return 0; | |
} | |
public override long Seek(long offset, SeekOrigin origin) | |
{ | |
return 0; | |
} | |
public override void SetLength(long value) | |
{ | |
} | |
public override void Write(byte[] buffer, int offset, int count) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment