Last active
May 2, 2016 20:51
-
-
Save xplicit/fc5673cafd72022f58cde6ee24424480 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
| string result; | |
| using (MemoryStream ms = new MemoryStream()) | |
| { | |
| TextWriter tmp = Console.Out; | |
| using (StreamWriter sw = new StreamWriter(ms)) | |
| { | |
| Console.SetOut(sw); | |
| for (int i=0;i<10;i++) | |
| { | |
| Console.WriteLine("1=" + i.ToString()); | |
| } | |
| sw.Close(); | |
| Console.SetOut(tmp); | |
| result = System.Text.Encoding.UTF8.GetString(ms.ToArray()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment