Skip to content

Instantly share code, notes, and snippets.

@BanksySan
Created May 7, 2020 11:39
Show Gist options
  • Select an option

  • Save BanksySan/a2aa29d79d08274d795eac76e3dec10f to your computer and use it in GitHub Desktop.

Select an option

Save BanksySan/a2aa29d79d08274d795eac76e3dec10f to your computer and use it in GitHub Desktop.
Blog: Writing a Concurrent .NET Stream (3)
var bufferInput = new byte[] {1, 2, 3};
var bufferOutput = new byte[bufferInput.Length];
Console.WriteLine("bufferInput = {0,-2}", string.Join(", ", bufferInput));
Console.WriteLine("bufferOutput = {0,-2}", string.Join(", ", bufferOutput));
var memoryStream = new MemoryStream();
memoryStream.Write(bufferInput, 0, bufferInput.Length);
memoryStream.Position = 0;
memoryStream.Read(bufferOutput, 0, bufferInput.Length);
Console.WriteLine("bufferInput = {0}", string.Join(", ", bufferInput));
Console.WriteLine("bufferOutput = {0}", string.Join(", ", bufferOutput));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment