<?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>Roslyn CTP Introduces Interactive Code for C#</title><link>http://blogs.msdn.com/b/csharpfaq/archive/2012/01/30/roslyn-ctp-introduces-interactive-code-for-c.aspx</link><description>There's been a lot of posts on using the Roslyn CTP APIs for syntax trees, semantic binding, and IDE smart editor features. The Roslyn CTP also introduces a set of features for C# we refer to as "Interactive". These features won't be new to VB, but we</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Roslyn CTP Introduces Interactive Code for C#</title><link>http://blogs.msdn.com/b/csharpfaq/archive/2012/01/30/roslyn-ctp-introduces-interactive-code-for-c.aspx#10262346</link><pubDate>Tue, 31 Jan 2012 17:21:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10262346</guid><dc:creator>CSharpFAQ</dc:creator><description>&lt;p&gt;@Lior There are a few differences. &amp;nbsp;First, if you use ref.emit, you must know IL and construct code at a lower level and in a more complicated way, even if you use LCG and don&amp;#39;t have to emit assemblies, types, etc. &amp;nbsp;With the Roslyn Scripting APIs, you can simply execute snippets of code, or you can use compilation methods that create delegates from strings of source code or create class instances from strings of source code. &amp;nbsp;The compilation methods let you create code that compiles once for repeated execution, like ref.emit, but at a higher level, with more manageable/readable code.&lt;/p&gt;
&lt;p&gt;Another reason the Roslyn Scripting APIs can be more useful is if your goal is to easily open your application to scripting for your users. &amp;nbsp;You can take script files or snippets of code inputs and trivially execute them or compile them for repeated use. &amp;nbsp;The code can execute in a context where free identifiers bind to public members on a host supplied object so that the script code can call on your host applicaton to get at services or modify the behavior of the application. &amp;nbsp;Enabling users to work with these text-based assets can be a much better experience for them than their having to create VS solutions and projects to build DLLs against an API you have, then announce the DLLs to you for you to load, and so on.&lt;/p&gt;
&lt;p&gt;Another difference, if you squint a little :-), is that you can easily load new code to update or replace definitions with the Roslyn Scripting API. &amp;nbsp;If a user has a business rule or a custom command implementation that needs to be updated while the app is running, you can just re-execute their code in a scripting Session, and the later, more recent definitions of functions and so on hide older definiitions. &amp;nbsp;Of course, with ref.emit, if you&amp;#39;re holding onto some delegate or ref&amp;#39;ed code, you can always change your storage to point to new code you generated, but 1) the experience for the user is better and 2) it may be easiest for the host to just re-execute code in a single scripting method call than to get a rule form the user and transform that to IL.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Bill&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10262346" width="1" height="1"&gt;</description></item><item><title>re: Roslyn CTP Introduces Interactive Code for C#</title><link>http://blogs.msdn.com/b/csharpfaq/archive/2012/01/30/roslyn-ctp-introduces-interactive-code-for-c.aspx#10262017</link><pubDate>Tue, 31 Jan 2012 00:31:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10262017</guid><dc:creator>Lior Tal</dc:creator><description>&lt;p&gt;How is Reflection.Emit different from the &amp;quot;scripting&amp;quot; you are mentioning?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10262017" width="1" height="1"&gt;</description></item></channel></rss>