http://blogs.clariusconsulting.net/pga

Pablo Galiano's Blog

Go Back to
pga′s Latest post

Enabling C# or VB 3.5 inside a text template

What about adding any C# 3.5 feature (linq, extension methods, partial methods, etc) inside a text template file?

The procedure is really easy, just add the “C#v3.5″ or “VBv3.5″ to the language directive:

<#@ template language="C#v3.5"#>
<#@ Import Namespace="System.Linq" #>
<#@ Assembly Name="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>

Happy code generation…

Pablo

Comments