<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Using extension methods in T4 templates</title><link>http://blogs.msdn.com/garethj/archive/2008/10/30/using-extension-methods-in-t4-templates.aspx</link><description>Adam has a groovy post on T4 , but he's under the impression that you can't use C# extension methods in T4. I just wanted to discuss the limitations that exist and show how you can take advantage of this cool C#/VB 3.5 feature. Extension methods require</description><dc:language>en-GB</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Using extension methods in T4 templates | MS Tech News</title><link>http://blogs.msdn.com/garethj/archive/2008/10/30/using-extension-methods-in-t4-templates.aspx#9023271</link><pubDate>Thu, 30 Oct 2008 03:02:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9023271</guid><dc:creator>Using extension methods in T4 templates | MS Tech News</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://mstechnews.info/2008/10/using-extension-methods-in-t4-templates/"&gt;http://mstechnews.info/2008/10/using-extension-methods-in-t4-templates/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Using extension methods in T4 templates</title><link>http://blogs.msdn.com/garethj/archive/2008/10/30/using-extension-methods-in-t4-templates.aspx#9028706</link><pubDate>Sun, 02 Nov 2008 03:30:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9028706</guid><dc:creator>Andre Furtado</dc:creator><description>&lt;p&gt;I'd use that approach even if T4 supported nested classes. I believe T4 scripts should be as concise as possible, for obvious reasons (readability, debugging, maintanability, etc.).&lt;/p&gt;
&lt;p&gt;For that to happen, we should have, from one side, well-defined and simple to use framework completion interfaces. From the other side, powerful domain APIs are also welcome.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;-- AFurtado&lt;/p&gt;
</description></item><item><title>re: Using extension methods in T4 templates</title><link>http://blogs.msdn.com/garethj/archive/2008/10/30/using-extension-methods-in-t4-templates.aspx#9034576</link><pubDate>Mon, 03 Nov 2008 22:12:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9034576</guid><dc:creator>Sajjad</dc:creator><description>&lt;p&gt;right now T4 has good number of operators like &lt;/p&gt;
&lt;p&gt;&amp;lt;#= &amp;nbsp;(expression level)&lt;/p&gt;
&lt;p&gt;&amp;lt;# &amp;nbsp; (statement level)&lt;/p&gt;
&lt;p&gt;&amp;lt;#+ &amp;nbsp;(class level)&lt;/p&gt;
&lt;p&gt;we need another one&lt;/p&gt;
&lt;p&gt;&amp;lt;#* (namespace level)&lt;/p&gt;
&lt;p&gt;another improvement i wish they do is that if i use &lt;/p&gt;
&lt;p&gt;&amp;lt;#+&lt;/p&gt;
&lt;p&gt;there should be a better way to do templating same as i can do at file start level may be somthing like&lt;/p&gt;
&lt;p&gt;&amp;lt;#+ void GenerateACode(int x) { &amp;amp;&amp;gt;&lt;/p&gt;
&lt;p&gt;this is my template&lt;/p&gt;
&lt;p&gt;&amp;lt;# if(x==1){ #&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;second part &lt;/p&gt;
&lt;p&gt;&amp;lt;# } #&lt;/p&gt;
&lt;p&gt;#&amp;gt;&lt;/p&gt;
&lt;p&gt;with &amp;amp;&amp;gt; it would produce output within functions scope of &amp;lt;#+ &lt;/p&gt;
&lt;p&gt;etc&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Sajjad&lt;/p&gt;
</description></item><item><title>re: Using extension methods in T4 templates</title><link>http://blogs.msdn.com/garethj/archive/2008/10/30/using-extension-methods-in-t4-templates.aspx#9034609</link><pubDate>Mon, 03 Nov 2008 22:21:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9034609</guid><dc:creator>Gareth Jones</dc:creator><description>&lt;p&gt;The namespace-level operator is an interesting idea, although it would make combining templates more tricky.&lt;/p&gt;
&lt;p&gt;I'm a bit lost with your second request.&lt;/p&gt;
&lt;p&gt;it look sliek you're asking to be able to mix function declarations with boilerplate blocks?&lt;/p&gt;
&lt;p&gt;If so, then this already works, but you need to use &amp;lt;#+ for all new blocks AFTER the first &amp;lt;#+ section.&lt;/p&gt;
</description></item></channel></rss>