Skip to content

Error: cannot convert from 'System.IO.StreamWriter' to 'System.IO.Stream' #2513

Answered by tocsoft
daryl-williams asked this question in Q&A
Discussion options

You must be logged in to vote

This should work (untested).

var stdout = Console.OpenStandardOutput()
image.Save(stdout, new JpegEncoder());
stdout.Flush()

Ths issue you are hitting is that you are using the API/streams completly wrong, You are trying to pass a StreamWriter (which is a type for simplifying wrting text to a stream) instead of the stream itself.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@daryl-williams
Comment options

Answer selected by tocsoft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants