I want to be able to use a template in a loop, like so:<br /><br /> @{ var fooView = new FooView(); } <!-- FooView is a compiled template that outputs a li --><br /> <ul><br /> @foreach (var foo in foos) {<br /> @{<br /> fooView.Clear(); <br /> fooView.Foo = foo;<br /> }<br /> @fooView.TransformText()<br /> }<br /> </ul><br /><br />The lack of a `Clear()` method means that each time I call `TransformText()` the internal `StringBuilder` (`_generatingEnvironment`) just keeps appending new `<li>`s.
↧