Skip to content

Instantly share code, notes, and snippets.

@markrendle
Created July 24, 2019 08:41
Show Gist options
  • Save markrendle/01b8b70d2b7c4f023bf196e96562c14a to your computer and use it in GitHub Desktop.
Save markrendle/01b8b70d2b7c4f023bf196e96562c14a to your computer and use it in GitHub Desktop.
IndentedTextWriter Async Fail
using System.CodeDom.Compiler;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace IndentFail
{
class Program
{
static async Task Main(string[] args)
{
var sb = new StringBuilder();
var sw = new StringWriter(sb);
var tw = new IndentedTextWriter(sw);
tw.Indent++;
await tw.WriteLineAsync("Foo");
await tw.WriteLineAsync("Bar");
await tw.WriteLineAsync();
await tw.WriteLineAsync("Quux");
await tw.WriteLineAsync("Wibble");
System.Console.WriteLine(sb.ToString());
}
}
}
Foo
Bar
Quux
Wibble
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment