Skip to content

Commit

Permalink
Fix preprocessed template sample in READNE
Browse files Browse the repository at this point in the history
Fixes #158
  • Loading branch information
mhutch committed Oct 2, 2023
1 parent c5a3639 commit 52e3f36
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dotnet-t4/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ Number | Square | Cube
Alternatively, invoking `t4 powers.tt -c MyApp.Powers` will produce a `powers.cs` file containing the runtime template class, which you can compile into your app and execute at runtime with new parameter values:

```csharp
string powersTableMarkdown = new MyApp.Powers { Max = 10 }.Process();
var template = new MyApp.Powers {
Session = new Dictionary<string, object> {
{ "Max", 10 }
}
};
template.Initialize();
string powersTableMarkdown = template.TransformText();
```

To learn more about the T4 language, see the [Visual Studio T4 documentation](https://learn.microsoft.com/en-us/visualstudio/modeling/writing-a-t4-text-template?view=vs-2022).
Expand Down

0 comments on commit 52e3f36

Please sign in to comment.