/C# - Stream to String.cs Secret
Last active
March 17, 2016 07:16
C# - String to Stream & Stream to String
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
// convert stream to string | |
StreamReader reader = new StreamReader(stream); | |
string text = reader.ReadToEnd(); |
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
// convert string to stream | |
byte[] byteArray = Encoding.UTF8.GetBytes(contents); | |
//byte[] byteArray = Encoding.ASCII.GetBytes(contents); | |
MemoryStream stream = new MemoryStream(byteArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment