<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Shiju Varghese's Blog : C#</title><link>http://weblogs.asp.net/shijuvarghese/archive/tags/C_2300_/default.aspx</link><description>Tags: C#</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Using .Net 3.5 and C# 3.0 features in T4 templates</title><link>http://weblogs.asp.net/shijuvarghese/archive/2009/06/03/using-net-3-5-and-c-3-0-features-in-t4-templates.aspx</link><pubDate>Wed, 03 Jun 2009 12:12:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7107041</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=7107041</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=7107041</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2009/06/03/using-net-3-5-and-c-3-0-features-in-t4-templates.aspx#comments</comments><description>&lt;p&gt;The T4 templates are compiled against .Net Framework 2.0 by default and it will be restricted to use LINQ and other .Net 3.5 features in your T4 templates.&amp;nbsp; If you want to use any of C# 3.0 or .Net 3.5 features in your T4 templates, you have to specify T4 templates language attribute is C#v3.5 instead of C#. The .Net 3.5 features are using System.Core namespace so that you have to give reference to System.Core namespace in the T4 templates.&lt;br&gt;&lt;br&gt;The below is the syntax &lt;br&gt;&lt;/p&gt;&lt;div style="background: rgb(248, 248, 248) none repeat scroll 0% 0%; font-family: Consolas; font-size: 13pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="background: gray none repeat scroll 0% 0%; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/span&gt;&amp;nbsp;&lt;span style="background: rgb(255, 215, 0) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&amp;lt;#@&lt;/span&gt;&lt;span style="color: navy;"&gt; &lt;/span&gt;&lt;span style="color: rgb(165, 42, 42); font-weight: bold;"&gt;template&lt;/span&gt;&lt;span style="color: navy;"&gt; language=&lt;/span&gt;"&lt;span style="background: rgb(255, 255, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;C#v3.5&lt;/span&gt;"&lt;span style="color: navy;"&gt; hostspecific=&lt;/span&gt;"&lt;span style="background: rgb(255, 255, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;True&lt;/span&gt;"&lt;span style="color: navy;"&gt; &lt;/span&gt;&lt;span style="color: navy;"&gt;&lt;/span&gt;&lt;span style="background: rgb(255, 215, 0) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;#&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="background: gray none repeat scroll 0% 0%; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&lt;/span&gt;&amp;nbsp;&lt;span style="background: rgb(255, 215, 0) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&amp;lt;#@&lt;/span&gt;&lt;span style="color: navy;"&gt; &lt;/span&gt;&lt;span style="color: rgb(165, 42, 42); font-weight: bold;"&gt;assembly&lt;/span&gt;&lt;span style="color: navy;"&gt; name=&lt;/span&gt;"&lt;span style="background: rgb(255, 255, 230) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;System.Core&lt;/span&gt;"&lt;span style="color: navy;"&gt; &lt;/span&gt;&lt;span style="background: rgb(255, 215, 0) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;#&amp;gt;&lt;/span&gt;&lt;span style="color: navy;"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7107041" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net+3.5/default.aspx">.Net 3.5</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/T4/default.aspx">T4</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/C_2300_/default.aspx">C#</category></item></channel></rss>