public static string GetContentAndClear(this StringWriter writer) { var content = writer.GetContent(); writer.Clear(); return(content); }