Skip to content

Instantly share code, notes, and snippets.

@AshV
Created December 18, 2017 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshV/76445ed770f83ee06ebfdedeae8397fd to your computer and use it in GitHub Desktop.
Save AshV/76445ed770f83ee06ebfdedeae8397fd to your computer and use it in GitHub Desktop.
// https://stackoverflow.com/questions/1879395/how-do-i-generate-a-stream-from-a-string
public static Stream GenerateStreamFromString(string s)
{
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(s);
writer.Flush();
stream.Position = 0;
return stream;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment