<?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>Charlie Calvert's Community Blog : Dynamic</title><link>http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx</link><description>Tags: Dynamic</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Videos of C# Authors at PDC</title><link>http://blogs.msdn.com/charlie/archive/2009/11/24/videos-of-c-authors-at-pdc.aspx</link><pubDate>Tue, 24 Nov 2009 08:04:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9927794</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9927794.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9927794</wfw:commentRss><description>&lt;p&gt;Here are links to a few short video interviews by &lt;a href="http://www.youtube.com/user/prebynski"&gt;prebynski&lt;/a&gt; with C# MVPs and luminaries speaking while they attended PDC 2009 last week in Los Angeles. This is a chance to hear the interests and opinions of folks who are immersed in the culture and technology surrounding C#. All three of these interviewees are with authors who are currently working on new books about C#. Hear their take on new technologies such as Azure and Dynamic in C#, as well as their thoughts on the latest developments in existing technologies such as LINQ, WPF and Silverlight.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=vDdBBEEMUaU"&gt;Bill Wagner on C#&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=1eFS5AaPAT0&amp;amp;NR=1"&gt;Mark Michaelis on C#&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.youtube.com/user/prebynski#p/a/u/0/mxQfOO5eJf8"&gt;Paul Kimmel on C# and LINQ&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f11%2f24%2fvideos-of-c-authors-at-pdc.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f11%2f24%2fvideos-of-c-authors-at-pdc.aspx" /&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9927794" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Azure/default.aspx">Azure</category></item><item><title>New Article by Bill Wagner on Dynamic Method Bags in C# 4.0</title><link>http://blogs.msdn.com/charlie/archive/2009/11/03/new-article-by-bill-wagner-on-dynamic-method-bags.aspx</link><pubDate>Tue, 03 Nov 2009 22:30:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9917015</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9917015.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9917015</wfw:commentRss><description>&lt;p&gt;C# MVP and wunderkind Bill Wagner has written an article entitled &lt;a href="http://msdn.microsoft.com/en-us/library/ee658247.aspx"&gt;Dynamic Method Bags&lt;/a&gt; which is now available on MSDN. Bill explores the new dynamic feature in C# 4.0. Most posts on this subject explain how to use dynamic to call Python, Ruby or Office. In his article, Bill explains how dynamic can be used not to call another language or tool, but to call your own C# objects without directly using the reflection API’s. The solution he provides combines generics, expression tress and dynamic to create a “type that allows developers to add new methods at runtime” and call those methods through dynamic dispatch.&lt;/p&gt;  &lt;h2&gt;Resources&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee658247.aspx"&gt;Bill’s Dynamic Method Bags article&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://srtsolutions.com/blogs/billwagner/"&gt;Bills Blog&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Download a Doc file providing an &lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3550"&gt;Overview of C# 4.0 Language Features&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/csharpfuture"&gt;C# Future Samples&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vcsharp/dd819407.aspx"&gt;Visual C# 2010 Resources&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx"&gt;VS 2010 Walkthroughs&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/vbteam/archive/2008/12/17/walkthrough-dynamic-programming-in-visual-basic-10-0-and-c-4-0-lisa-feigenbaum.aspx"&gt;Some Dynamic Walkthroughs&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.codeplex.com/wikipage?ProjectName=IronPython"&gt;IronPython on CodePlex&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://ironruby.net/"&gt;IronRuby&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f11%2f03%2fnew-article-by-bill-wagner-on-dynamic-method-bags.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f11%2f03%2fnew-article-by-bill-wagner-on-dynamic-method-bags.aspx" /&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917015" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category></item><item><title>Running IronPython Scripts from a C# 4.0 Program</title><link>http://blogs.msdn.com/charlie/archive/2009/10/25/hosting-ironpython-in-a-c-4-0-program.aspx</link><pubDate>Mon, 26 Oct 2009 06:41:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9912809</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9912809.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9912809</wfw:commentRss><description>&lt;p&gt;IronPython is a scripting language hosted on the .NET platform. This posts shows how you can use the &lt;a href="http://www.codeplex.com/dlr"&gt;Dynamic Language Runtime (DLR)&lt;/a&gt; and the new &lt;a href="http://code.msdn.microsoft.com/csharpfuture"&gt;C# 4.0&lt;/a&gt; &lt;strong&gt;dynamic&lt;/strong&gt; keyword to call an IronPython script from a C# program.&lt;/p&gt; &lt;p&gt;Before going any further, it might be helpful to take a moment to explore the architecture that makes this technology possible. The key building block is the DLR, which sits on top of the .NET 4.0 CLR and provides the tooling for adding dynamic programs such as Python to the family of .NET languages. C# 4.0 adds the &lt;strong&gt;dynamic&lt;/strong&gt; keyword and some related technologies to integrate support for dynamic binding into the language. The end result is that developers can arbitrary Python scripts directly from C# or other .NET languages.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=linqfarm&amp;amp;DownloadId=7927"&gt;Download Source&lt;/a&gt; from the &lt;a href="http://code.msdn.microsoft.com/linqfarm"&gt;LinqFarm&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;Setting up a C# Project to Call IronPython&lt;/h2&gt; &lt;p&gt;In two previous posts I described how to install and run a simple IronPython program:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2009/10/22/ironruby-and-ironpython-for-net-4-0-beta-2-available.aspx"&gt;Announcing IronPython and IronRuby releases for Visual Studio 2010 Beta 2&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2009/10/25/running-ironpython.aspx"&gt;Getting Started with IronPython&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you don’t already have the latest version of IronPython installed or if you need a little refresher course in writing Python scripts, then you might want to glance at these posts. Otherwise, you can just keep reading to learn how to call Python from C#.&lt;/p&gt; &lt;p&gt;After the IronPython installation, its interpreter and its libraries will be installed in your &lt;strong&gt;Program Files&lt;/strong&gt; directory, as shown in Listing 1. The interpreter is installed in &lt;strong&gt;ipy.exe&lt;/strong&gt;, where ipy is pronounced “Eye-Pie.” The interpreter remains dormant when you call Python from C#, so our focus here should be on the assemblies shown in the second half of the listing, with a particular emphasis on &lt;strong&gt;IronPython.dll&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Listing 1: At the command prompt you can easily see the core files that form the basis for the IronPython installation.&lt;/strong&gt;&lt;/p&gt;&lt;pre class="myclass"&gt;C:\Program Files (x86)\IronPython 2.6 CTP for .NET 4.0 Beta 2&amp;gt;dir *.exe *.dll
 Volume in drive C has no label.
 Volume Serial Number is 4C6B-EE0E

 Directory of C:\Program Files (x86)\IronPython 2.6 CTP for .NET 4.0 Beta 2

10/18/2009  01:47 PM            12,624 ipy.exe
10/18/2009  01:47 PM            12,624 ipyw.exe

 Directory of C:\Program Files (x86)\IronPython 2.6 CTP for .NET 4.0 Beta 2

10/18/2009  01:47 PM         1,433,424 IronPython.dll
10/18/2009  01:47 PM           435,536 IronPython.Modules.dll
10/18/2009  01:47 PM           875,856 Microsoft.Dynamic.dll
10/18/2009  01:47 PM            58,192 Microsoft.Scripting.Debugging.dll
10/18/2009  01:47 PM           159,056 Microsoft.Scripting.dll
               7 File(s)      2,987,312 bytes
               0 Dir(s)  16,881,614,848 bytes free&lt;/pre&gt;
&lt;p&gt;To run a Python script inside a C# program, you should include some or all of the libraries shown in Listing 1 in the &lt;strong&gt;References&lt;/strong&gt; section of your project. To get started, choose&lt;strong&gt; File | New Project (Ctrl-Shift-N)&lt;/strong&gt; from the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;Visual Studio 2010&lt;/a&gt; menu and create a new console application. Then open the &lt;strong&gt;Solution Explorer (Ctrl-W, S)&lt;/strong&gt; and go to the &lt;strong&gt;References&lt;/strong&gt; section for your project. Right click and choose&lt;strong&gt; Add Reference.&lt;/strong&gt; Take a moment to appreciate how quickly the &lt;strong&gt;Add References&lt;/strong&gt; dialog appeared (the team worked hared on this performance improvement), and then select the &lt;strong&gt;Browse&lt;/strong&gt; tab and navigate to the directory where IronPython resides. The path to the directory hosting IronPython will probably be similar to the one shown in Listing 1. For now, the simplest choice is to select all the assemblies found in that directory, as shown in Figure 1. If you wish to keep things simple, then you only need to select &lt;strong&gt;IronPython.dll, Microsoft.Dynamic.dll&lt;/strong&gt; and &lt;strong&gt;Microsoft.Scripting.dll &lt;/strong&gt;to compile and run the program shown in this example.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Figure01" border="0" alt="Figure01" src="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/HostingIronPythoninaC4.0Program_147F2/Figure01_6.png" width="486" height="412"&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1: Using the &lt;em&gt;&lt;u&gt;Add References&lt;/u&gt;&lt;/em&gt; dialog to select the assemblies found in that directory.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When you are done, the IronPython libraries should appear in the &lt;strong&gt;References&lt;/strong&gt; section of the &lt;strong&gt;Solution Explorer&lt;/strong&gt;, as shown in Figure 2.&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Figure02" border="0" alt="Figure02" src="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/HostingIronPythoninaC4.0Program_147F2/Figure02_3.png" width="286" height="410"&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2: The References node of the Solution Explorer for a C# program that calls an IronPython script.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;Writing the Code for Calling IronPython&lt;/h2&gt;
&lt;p&gt;Now that you have your project set up correctly you need to do two things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Write or find a script containing Python code that you want to run 
&lt;li&gt;Write C# code to call the script. &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Listing 2 shows a very simple IronPython script that contains a single method called &lt;strong&gt;Simple() &lt;/strong&gt;that writes a few strings to a console window. Save this script to a file called Test.py, and add it to your project, as shown in Figure 2. There are several ways to do this. One is to right click on your project in the Solution Explorer, and choose &lt;strong&gt;Add | New Item. &lt;/strong&gt;Add a text file, and call it &lt;strong&gt;Test.py&lt;/strong&gt;. Click on the new node when it is added to your project, and set its &lt;strong&gt;Copy to Output Directory&lt;/strong&gt; property to &lt;strong&gt;Copy Always. &lt;/strong&gt;If the Properties window is not visible, you can bring it up by selecting Ctrl-W, P.&lt;/p&gt;
&lt;p&gt;Listings 3a and 3b show the C# code for calling the script, and Listing 4 shows the output from the C# program that hosts the script.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Listing 2: A Simple Python script stored in a file called Test.py. This code prints out some basic information about the environment in which Python is running.&lt;/strong&gt;&lt;/p&gt;&lt;pre class="myclass"&gt;import sys

def Simple():
	print "Hello from Python"
	print "Call Dir(): "
	print dir()
	print "Print the Path: " 
	print sys.path&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Listing 3a: A simple C# program for calling a Python script&lt;/strong&gt;&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:582600b1-95f9-44b5-a83f-01d23c2d1477" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;
&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;
&lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; IronPython.Hosting;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Microsoft.Scripting.Hosting;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;dynamic_demo&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;
&lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main()&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt;
&lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; ipy = &lt;span style="color:#2b91af"&gt;Python&lt;/span&gt;.CreateRuntime();&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;dynamic&lt;/span&gt; test = ipy.UseFile(&lt;span style="color:#a31515"&gt;&amp;quot;Test.py&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;test.Simple();&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Listing 3b: The same C# program shown in Listing 3a, but this presentation is easier for you to block copy into your own version of the program.&lt;/strong&gt;&lt;/p&gt;&lt;pre class="myclass"&gt;using System;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;

public class dynamic_demo
{
    static void Main()
    {
        var ipy = Python.CreateRuntime();
        dynamic test = ipy.UseFile("Test.py");
        test.Simple();
    }
}&lt;/pre&gt;
&lt;p&gt;The code in Listing 2 is a very simple Python script. Before calling it from C#, you might want to see it in action. That way you can be sure the script works and you can verify what the script is supposed to do. To get started, block copy the code in Listing 2. Use the Windows Start Menu to open up the Python Console window and paste in the code. Finally, you should explicitly call the &lt;strong&gt;Simple()&lt;/strong&gt; method, as shown in Figure 3. When looking at this screen shot, you can see the version of the Python Console on the first two lines. The next 8 lines show the code that I pasted into the console. Finally, you see where I typed in the call to &lt;strong&gt;Simple(),&lt;/strong&gt; and after that the output from the script. Once again, this has nothing to do with calling the code from C#, it is just a way of verifying that you have a valid script, and of confirming how it should perform.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/HostingIronPythoninaC4.0Program_AB98/Figure03_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Figure03" border="0" alt="Figure03" src="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/HostingIronPythoninaC4.0Program_AB98/Figure03_thumb.png" width="644" height="327"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3: A screenshot showing a run of the Python script that we will be calling from our C# program.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now let’s look at the 3 lines of code used to call this script from a C# program. This code is shown in Listings 3a and 3b. It first creates an instance of the Python runtime, as shown in line 9:&lt;/p&gt;&lt;pre class="myclass"&gt;var ipy = Python.CreateRuntime();&lt;/pre&gt;
&lt;p&gt;The call to &lt;strong&gt;CreateRunTime&lt;/strong&gt; loads or sets up the core Python libraries and the &lt;a href="http://www.codeplex.com/dlr"&gt;DLR code&lt;/a&gt; needed to to execute the Python script. The second line of code, found on line 10, calls &lt;strong&gt;UseFile&lt;/strong&gt; to load our simple Python script into memory. Notice that the result of this call is a &lt;strong&gt;dynamic&lt;/strong&gt; object. The &lt;strong&gt;dynamic&lt;/strong&gt;&amp;nbsp; keyword is a new feature in C# 4.0 and Visual Studio 2010 which tells the compiler to resolve this particular call not at compile time, but at runtime.&lt;/p&gt;
&lt;p&gt;It’s very important to understand that the dynamic keyword breaks the strong type checking that has always been a hallmark of C# development. There is no doubt that the ability to call dynamic objects is a useful and important feature. However, it should be used sparingly since it sidesteps the strict type checking that makes C# such a powerful and useful language.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;dynamic&lt;/strong&gt; keyword is needed here because Python is an interpreted scripting language where calls are bound at run time, not at compile time. There is no simple or practical way to bind calls to Python at compile time because Python is designed to be a dynamic language which is resolved at runtime. Since C# is a strongly typed language it expects to resolve calls at compile time with strict type checking. In short, we are at an impasse. C# binds statically at compile time, Python dynamically at runtime. Something has to give, and the only valid solution was for C# to allow runtime binding for method calls. &lt;/p&gt;
&lt;p&gt;It is important to grasp that calls into Python are not strictly type checked at compile time, and are therefore not guaranteed to succeed at runtime. Just because your program compiled without error does not mean that you have properly bound each call in your program. In this case we call the method named &lt;strong&gt;Simple()&lt;/strong&gt;, which does in fact exist. As a result, the call succeeds, as shown by the output from the program found in Listing 4. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Listing 4: The output from the C# program which calls a Python script.&lt;/strong&gt;&lt;/p&gt;&lt;pre class="myclass"&gt;Hello from Python
Call Dir():
[]
Print the Path:
['.', 'C:\\Users\\Charlie\\Documents\\SyncData\\Source\\ProjectsShared\\Python\\CallPython\\CallPython\\bin\\Debug\\Lib', 
'C:\\Users\\Charlie\\Documents\\SyncData\\Source\\ProjectsShared\\Python\\CallPython\\CallPython\\bin\\Debug\\DLLs']
Press any key to continue . . .&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;p&gt;Listing 4 shows the good side of working with dynamic code. Now let’s take a moment to consider the dark side. Suppose we called a method on our dynamic test class that does not exist. For the sake of argument, let’s call the method &lt;strong&gt;NonexistentMethod(),&lt;/strong&gt; which is shown in Listing 5. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Listing 5: This code contains a call to a method called NonexistentMethod() that does not exist in our Test.py file. As a result, the call will fail at runtime.&lt;/strong&gt;&lt;/p&gt;&lt;pre class="myclass"&gt; var ipy = Python.CreateRuntime();
dynamic test = ipy.UseFile("Test.py");
test.Simple();            // Succeeds
test.NonexistentMethod(); // Fails&lt;/pre&gt;
&lt;p&gt;The code in Listing 5 contains a call to the method &lt;strong&gt;Simple()&lt;/strong&gt; that will succeed, since the Python script shown in Listing 2 does contain a method called &lt;strong&gt;Simple()&lt;/strong&gt;. However, the call to the method &lt;strong&gt;NonexistentMethod()&lt;/strong&gt; will raise an exception at runtime. This happens because the call cannot be resolved at runtime. At compile time, however, the compiler knows nothing about the object called &lt;strong&gt;test&lt;/strong&gt;. It makes no attempt to see whether or not the call will succeed. It simply takes your word for it and allows the compilation to succeed. At runtime, however, the error raises its head, as shown in Figure 4 and Listing 6.&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Figure03a" border="0" alt="Figure03a" src="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/HostingIronPythoninaC4.0Program_147F2/Figure03a_3.png" width="456" height="256"&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 4: The exception raised inside the IDE at runtime when you attempt to call a method that does not exist.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Listing 6: The details of the exception that you receive at runtime when you attempt to call a method that does not exist.&lt;/strong&gt;&lt;/p&gt;&lt;pre class="myclass"&gt;Microsoft.CSharp.RuntimeBinder.RuntimeBinderException was unhandled
  Message='Microsoft.Scripting.Hosting.ScriptScope' does not contain a definition for 'NonexistentMethod'
  Source=Anonymously Hosted DynamicMethods Assembly
  StackTrace:
       at CallSite.Target(Closure , CallSite , Object )
       at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0](CallSite site, T0 arg0)
       at dynamic_demo.Main() in C:\Users\Charlie\Documents\SyncData\Source\ProjectsShared\Python\CallPython\CallPython\Program.cs:line 12
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
&lt;/pre&gt;
&lt;p&gt;The team went to lengths to ensure that the error you get at runtime looks almost exactly like the error you would have received at compile time had you attempted to call a static method that did not exist. Everything possible is done to make this experience easy for your to understand and handle, including giving you an exception that you can catch with your own custom code. &lt;/p&gt;
&lt;p&gt;It goes without saying that everyone on the Visual Studio Languages team at Microsoft understands the implications of introducing the &lt;strong&gt;dynamic&lt;/strong&gt; keyword into the C# language. We understand completely the advantages of statically linked code, and believe that strict type checking is a powerful tool that helps developers create robust code. In most cases, you should still use statically linked calls in your program. There are, however, scenarios that cannot be efficiently supported from the C# language without the introduction of dynamic programming. One is calling a dynamic language such as Python, and another is calling into a some COM objects, such as those used in those used by Microsoft Office. In order to make it easy for you to use dynamic languages and to perform COM Interop, the dynamic keyword was introduced into the C# 4.0 language, and the DLR became a built-in extension of .NET 4.0. Use these tools judiciously, and they will be your friend. Abuse them, and you are on your own.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;In this article you learned how to call a simple Python script from a C# application. You saw how to set up the &lt;strong&gt;References&lt;/strong&gt; section for your program so that it contains the assemblies used when calling an IronPython script. You then saw how to write a simple Python script, and how to call it from a C# program.&lt;/p&gt;
&lt;p&gt;The dynamic technology on display in this example makes use of a body of code called the DLR, or Dynamic Language Runtime. The &lt;strong&gt;dynamic&lt;/strong&gt; keyword that is part of C# 4.0 provides supports when you call dynamic languages or COM objects, and particularly when you use C# 4.0 to call into Microsoft Office applications. Coverage of calling into Office is separate subject, and will be covered in another post. A third topic deserving of coverage is using the &lt;strong&gt;dynamic&lt;/strong&gt; keyword in scenarios where you previously used reflection. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=linqfarm&amp;amp;DownloadId=7927"&gt;Download Source&lt;/a&gt; from the &lt;a href="http://code.msdn.microsoft.com/linqfarm"&gt;LinqFarm&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f10%2f25%2fhosting-ironpython-in-a-c-4-0-program.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f10%2f25%2fhosting-ironpython-in-a-c-4-0-program.aspx"&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912809" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Python/default.aspx">Python</category></item><item><title>Getting Started with IronPython</title><link>http://blogs.msdn.com/charlie/archive/2009/10/25/running-ironpython.aspx</link><pubDate>Mon, 26 Oct 2009 01:03:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9912728</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9912728.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9912728</wfw:commentRss><description>&lt;style type="text/css"&gt;









 	pre.myclass {color:black; background:lightgray}
 &lt;/style&gt;  &lt;p&gt;I recently spent some time getting IronPython up and running on my system; I will review what I learned in this post. &lt;/p&gt;  &lt;p&gt;Hosted inside an interpreter, Python belongs to the same family of scripting tools as VBScript, JavaScript, Perl and Ruby. You can fairly compare Python to a general purpose language such as C#. Developers praise this loosely typed, dynamic language for its ease of use and rapid development capabilities. IronPython is Microsoft’s free version of the open source &lt;a href="http://www.python.org/"&gt;Python language&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;IronPython can be hosted inside a C# program as a scripting language. Nonetheless, Python is a powerful standalone language frequently used as the glue in web based applications. Before I came to work for Microsoft I enjoyed using it as part of my daily toolkit.&lt;/p&gt;  &lt;p&gt;In this post I explore the simple steps needed to run IronPython as a standalone tool from the command prompt. In other posts I will show how to call Python from inside a C# application.&lt;/p&gt;  &lt;h2&gt;Installing Python&lt;/h2&gt;  &lt;p&gt;I started by &lt;a href="http://blogs.msdn.com/charlie/archive/2009/10/22/ironruby-and-ironpython-for-net-4-0-beta-2-available.aspx"&gt;downloading IronPython&lt;/a&gt; from &lt;a href="http://www.codeplex.com/"&gt;CodePlex&lt;/a&gt; and installing it. The whole process from first visit to the IronPython web site until IronPython was installed probably took me little more than a minute. Below are the links to retrieve the code. If you are reading this article in 2009 or early 2010, consider using the first link, if the date is later than that then use the second link and look for a newer release:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28125"&gt;The Beta 2 Release of IronPython&lt;/a&gt; (2.6 CTP for .NET 4.0 Beta 2) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://ironpython.codeplex.com/"&gt;IronPython Site&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Download the IronPython MSI Windows install file, then double click on it to run setup. When you are done, your IronPython installation will probably be located in a directory similar to this one:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;C:\Program Files (x86)\IronPython 2.6 CTP for .NET 4.0 Beta 2&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Once you have the IronPython interpreter installed, you need to follow these steps to run a sample program:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Put IronPython on your Path &lt;/li&gt;    &lt;li&gt;Create an IronPython program &lt;/li&gt;    &lt;li&gt;Compile and run the program. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In the next few sections of this post I’ll walk you through these steps. When you are done, you will have IronPython up and running on your system.&lt;/p&gt;  &lt;h2&gt;Setting Up Your Path&lt;/h2&gt;  &lt;p&gt;You can run IronPython from inside Visual Studio, but the tools for doing so are still primitive. Most Python developers work inside a lightweight editor and run Python from inside the IronPython interpreter or from the command line. This post focuses on building Python from the command line. To get started with that process, you will probably want to begin by ensuring that the IronPython interpreter is on your System Path. &lt;/p&gt;  &lt;p&gt;They say there must be fifty ways to set &lt;a href="http://technet.microsoft.com/en-us/library/cc753427(WS.10,loband).aspx#BKMK_examples"&gt;the system path&lt;/a&gt;. In this post I will outline two of them as practiced by developers on Vista or Windows 7. In both cases you can begin with a four step process to bring up the &lt;strong&gt;Environment Variables Dialog&lt;/strong&gt;:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Method One      &lt;ul&gt;       &lt;li&gt;Press the Windows Key to bring up the Start Menu &lt;/li&gt;        &lt;li&gt;Right click on &lt;strong&gt;Computer&lt;/strong&gt; and choose &lt;strong&gt;Properties&lt;/strong&gt; &lt;/li&gt;        &lt;li&gt;Click &lt;strong&gt;Advanced Computer Settings&lt;/strong&gt; &lt;/li&gt;        &lt;li&gt;Click &lt;strong&gt;Environment&lt;/strong&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Method Two      &lt;ul&gt;       &lt;li&gt;Press the Windows Key to ring up the Start Menu &lt;/li&gt;        &lt;li&gt;Type &lt;strong&gt;Control Panel&lt;/strong&gt; and press enter &lt;/li&gt;        &lt;li&gt;You should be taken automatically to the search box on the top right of the control panel, if not, press Ctrl-E to get there and type &lt;strong&gt;Environment. &lt;/strong&gt;(The first three letters should be all that’s necessary) &lt;/li&gt;        &lt;li&gt;Hit tab twice to select &lt;strong&gt;Edit Environment Variables&lt;/strong&gt;, and then hit enter. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Which ever technique you use, the dialog shown in Figure 1 should appear. You can use this dialog to edit the system path. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Figure01" border="0" alt="Figure01" src="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/RunningIronPython_D2FC/Figure01_3.png" width="398" height="440" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 1: In this screenshot, a variable called Path has been added to the list of User Variables. It lists the path to the IronPython Interpreter.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Once the dialog appears, click New (Alt-N) to add a &lt;strong&gt;Path&lt;/strong&gt; variable for your account. A small dialog appears. Paste the path to IronPython into this dialog and click the OK button. The path should be similar to the path shown above which points to the directory where IronPython was installed. Click OK to close the Environment Variables dialog. From now on, and Command prompt window that you open should have an environment automatically set up to point to the IronPython interpreter. To test that everything is working correctly, go to the command prompt and type &lt;strong&gt;ipy&lt;/strong&gt;. If everything has gone well, you should see a result like the following. &lt;/p&gt;  &lt;pre class="myclass"&gt;C:\Users\Charlie\Documents\Python\PythonPost&amp;gt;ipy
IronPython 2.6 (2.6.10920.0) on .NET 4.0.21006.1
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt; exit()&lt;/pre&gt;

&lt;p&gt;As shown above, you can type&lt;strong&gt; exit()&lt;/strong&gt; and then &lt;strong&gt;enter&lt;/strong&gt; to quit the interpreter. You can also execute Python code from inside the interpreter. Working interactively inside the interpreter is a useful and powerful way to write code, but I will not cover it in this post.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Create a Python Program&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;Now that you have Python on your path, you can easily compile your projects from the command line. Depending on your tastes, you can edit your program in Visual Studio, in NotePad, or in &lt;a href="http://notepad-plus.sourceforge.net/"&gt;NotePad++&lt;/a&gt;. The goal is to create a simple text-based source file with the letters py as an extension. Here, for example, is the complete contents of a simple Python source file:&lt;/p&gt;

&lt;pre class="myclass"&gt;&lt;font color="#0000ff"&gt;print&lt;/font&gt; &amp;quot;Very Simple Test&amp;quot;&lt;/pre&gt;

&lt;p&gt;You can save this source file as &lt;strong&gt;VerySimpleTest.py&lt;/strong&gt;, and process and run it by passing its name to the Python interpreter. The interpreter will process and run the program:&lt;/p&gt;

&lt;pre class="myclass"&gt;C:\Users\Charlie\Documents\Python\PythonPost&amp;gt;ipy VerySmipleTest.py.
Very Simple Test&lt;/pre&gt;

&lt;p&gt;Now that you understand the basics, the next step is to understand how to create functions, classes and multiple module projects. &lt;/p&gt;

&lt;p&gt;Python uses indentation rather than keywords or syntax to define blocks of code. Here, for instance, is how to define a function in Python:&lt;/p&gt;

&lt;pre class="myclass"&gt;def WriteTest():
	print &amp;quot;This is a test&amp;quot;&lt;/pre&gt;

&lt;p&gt;The keyword &lt;strong&gt;def&lt;/strong&gt; followed by a name and a colon defines the header for the function. The next line begins with tab character. This defines the beginning of main block for the function, which in this case contains a single line of code. If you had multiple lines in the function, then you would indent each line with a tab character. An empty line defines the end of the function.&lt;/p&gt;

&lt;p&gt;To define a class, you repeat the same process, but use the keyword &lt;strong&gt;class&lt;/strong&gt; rather than &lt;strong&gt;def&lt;/strong&gt;:&lt;/p&gt;

&lt;pre class="myclass"&gt;class SimpleLocalClass:
	def SimpleMethod(self):
		print &amp;quot;Simple Local Class&amp;quot;&lt;/pre&gt;

&lt;p&gt;Here you see the definition for a class called &lt;strong&gt;SimpleLocalClass&lt;/strong&gt; which has a single method called &lt;strong&gt;SimpleMethod&lt;/strong&gt;. Not everyone likes the Python syntax for defining classes and methods, but I have found intuitive and easy to use. &lt;/p&gt;

&lt;p&gt;Listings 1 and 2 contain a project with two files that demonstrates how to use functions and classes in Python:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Listing 1: Here is the main module for the project. It is a simple source file called &lt;u&gt;&lt;em&gt;Project.py&lt;/em&gt;&lt;/u&gt; containing a function and a simple class. This source file also has a dependency on a class called &lt;em&gt;&lt;u&gt;SimpleClassTest&lt;/u&gt;&lt;/em&gt; that is shown in Listing 2&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="myclass"&gt;from SimpleClass import SimpleClassTest

class SimpleLocalClass:
	def SimpleMethod(self):
		print &amp;quot;Simple Local Class&amp;quot;

def WriteTest():
	print &amp;quot;This is a test&amp;quot;
	
WriteTest()

simpleLocalClass = SimpleLocalClass()
simpleLocalClass.SimpleMethod()

simpleClass = SimpleClassTest()
simpleClass.SimpleMethod()	&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Listing 2: The second file in this project is called &lt;/strong&gt;&lt;u&gt;&lt;em&gt;SimpleClass.py&lt;/em&gt;&lt;/u&gt;&lt;strong&gt;. The file shown in Listing 1 depends on this class.&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="myclass"&gt;class SimpleClassTest:
	def SimpleMethod(self):
		print &amp;quot;Simple Class&amp;quot;&lt;/pre&gt;

&lt;p&gt;Notice the &lt;strong&gt;from&lt;/strong&gt; statement at the top of Listing 1. It is used to import the class found in Listing 2. I should also point out that there is no &lt;strong&gt;main()&lt;/strong&gt; method shown in listing 1. The word &lt;strong&gt;main&lt;/strong&gt; does not have the same significance in Python that it does in C#. The entry point for this Python program is the last set of un-indented statements found in &lt;strong&gt;Project.py&lt;/strong&gt;&lt;strong&gt;. &lt;/strong&gt;In this case the entry point begins with the call to &lt;strong&gt;WriteTest().&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Compiling and Running the Program&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;Now that you have the two source files for your project, all you need do is compile and run them. The Python interpreter is designed to make this task as simple as possible. You need only reference the primary file for your project, the interpreter is smart enough to to parse the &lt;strong&gt;from&lt;/strong&gt; import statement at the top of Listing 1 and figure out from that how to include &lt;strong&gt;SimpleClass.py&lt;/strong&gt; in the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Listing 3: Here is the command to process and run the files shown in Listings 1 and 2. The output from the command is also shown.&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="myclass"&gt;C:\Users\Charlie\Python\PythonPost&amp;gt;ipy Project.py
This is a test
Simple Local Class
Simple Class&lt;/pre&gt;

&lt;h2&gt;Summary &lt;/h2&gt;

&lt;p&gt;In this post I have reviewed how to download and install IronPython, and how to get some simple Python scripts up and running on your system. You saw how to run a simple program from the command line, how to create:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A simple function&lt;/li&gt;

  &lt;li&gt;A simple class&lt;/li&gt;

  &lt;li&gt;And a mutli-module project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In future posts I will focus on calling IronPython from a C# program.&lt;/p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f10%2f25%2frunning-ironpython.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f10%2f25%2frunning-ironpython.aspx" /&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912728" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Python/default.aspx">Python</category></item><item><title>IronRuby and IronPython for .NET 4.0 Beta 2 Available</title><link>http://blogs.msdn.com/charlie/archive/2009/10/22/ironruby-and-ironpython-for-net-4-0-beta-2-available.aspx</link><pubDate>Thu, 22 Oct 2009 19:45:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911641</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9911641.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9911641</wfw:commentRss><description>&lt;p&gt;The third preview of IronRuby and IronPython running under &lt;a href="http://dlr.codeplex.com/"&gt;the Dynamic Language Runtime&lt;/a&gt; and .NET 4.0 is now available. You can easily use IronPython and IronRuby objects and types as .NET 4.0 dynamic objects from within the pre-release versions of C# 4.0 and Visual Basic 10.0 found in Visual Studio 2010. The IronRuby and IronPython binaries are roughly equivalent to the functionality found in IronRuby 0.9 and IronPython 2.6. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/IronRubyandIronPythonfor.0Beta2Available_B35B/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" hspace="12" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/charlie/WindowsLiveWriter/IronRubyandIronPythonfor.0Beta2Available_B35B/clip_image002_thumb.jpg" width="225" height="195" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Links&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.jimmy.schementi.com/2009/10/ironruby-and-ironpython-ctps-for-net-40.html"&gt;Announcement&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28125"&gt;IronPython&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33305"&gt;IronRuby&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Build IronPython from source: &lt;a href="http://ironpython.codeplex.com/SourceControl/ListDownloadableCommits.aspx"&gt;CodePlex&lt;/a&gt; (Use v4) &lt;/li&gt;    &lt;li&gt;Build IronRuby from source: &lt;a href="http://github.com/ironruby/ironruby"&gt;GitHub&lt;/a&gt; (&lt;a href="http://github.com/ironruby/ironruby/zipball/master"&gt;direct download&lt;/a&gt;) (Use v4) &lt;/li&gt;    &lt;li&gt;A&amp;#160; &lt;a href="http://devhawk.net/2009/10/21/IronPython+And+IronRuby+CTPs+For+NET+40+Beta+2.aspx"&gt;post about this release&lt;/a&gt; was created by &lt;a href="http://devhawk.net"&gt;Harry Pierson&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;Install NET 4.0 Beta 2 or Visual Studio 2010 Beta 2&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/vbteam/archive/2008/12/17/walkthrough-dynamic-programming-in-visual-basic-10-0-and-c-4-0-lisa-feigenbaum.aspx"&gt;Dynamic walkthroughs&lt;/a&gt; online.       &lt;p&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt; &lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f10%2f22%2fironruby-and-ironpython-for-net-4-0-beta-2-available.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f10%2f22%2fironruby-and-ironpython-for-net-4-0-beta-2-available.aspx" /&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911641" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category></item><item><title>Recent Videos from the C# Team (2008-2009)</title><link>http://blogs.msdn.com/charlie/archive/2009/07/31/recent-videos-from-the-c-team.aspx</link><pubDate>Fri, 31 Jul 2009 23:17:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9854671</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9854671.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9854671</wfw:commentRss><description>&lt;p&gt;Here is a selection of videos created between July, 2008 and July, 2009 by members of the C# team at Microsoft:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/Charles/C-40-Meet-the-Design-Team/"&gt;C# 4.0 Meet the Design Team&lt;/a&gt;: &lt;strong&gt;Anders Hejlsberg, Eric Lippert&lt;/strong&gt;, et al &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2008/07/25/video-new-error-checking-feature-in-visual-studio-service-pack-1.aspx"&gt;Error Checking Feature in Visual Studio Service Pack 1&lt;/a&gt;: &lt;strong&gt;DJ Park&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/shows/Going+Deep/Inside-C-40-dynamic-type-optional-parameters-more-COM-friendly/"&gt;Inside C# 4.0 - Dynamic Typing, Optional Params, Variance&lt;/a&gt;:&lt;strong&gt; Sam Ng&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/Charles/Anders-Hejlsberg-and-Guy-Steele-Concurrency-and-Language-Design/"&gt;Concurrency and Language Design&lt;/a&gt;:&lt;strong&gt; Anders Hejlsberg&lt;/strong&gt; and&lt;strong&gt; Guy Steele&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL16/"&gt;The Future of C#&lt;/a&gt;: &lt;strong&gt;Anders Hejlsberg&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.microsoft.com/emea/teched2008/developer/tv/"&gt;The Joy of Writing Code in Visual Studio 2010&lt;/a&gt;: &lt;strong&gt;Karen Liu&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2008/11/13/anders-hejlsberg-video-on-c-dynamic.aspx"&gt;C# 4.0 Video on Dynamic&lt;/a&gt;: &lt;strong&gt;Anders Hejlsberg&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2008/12/03/jeff-richter-video-on-asynchronous-programming-and-his-power-threading-library.aspx"&gt;Asynchronous Programming Power Threading Library&lt;/a&gt;: &lt;strong&gt;Jeff Richter &lt;/strong&gt;and &lt;strong&gt;Charlie Calvert&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Anders-Hejlsberg-The-Future-of-C/"&gt;Expert to Expert – The Future of C#&lt;/a&gt;: &lt;strong&gt;Erik Meijer &lt;/strong&gt;and &lt;strong&gt;Anders Hejlsberg&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/Charles/Emmanuel-Stapf-Eiffel-and-Contract-Oriented-Programming/"&gt;Eiffel and Contract Oriented Programming&lt;/a&gt;: &lt;strong&gt;Mads Torgersen&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/Charles/Eric-Lippert-Happy-Birthday-C9/"&gt;Eric Lippert Happy Birthday&lt;/a&gt;: &lt;strong&gt;Eric Lippert&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt; &lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f07%2f31%2frecent-videos-from-the-c-team.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2009%2f07%2f31%2frecent-videos-from-the-c-team.aspx" /&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9854671" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://blogs.msdn.com/charlie/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Video/default.aspx">Video</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Parallel/default.aspx">Parallel</category></item><item><title>New Features in C# 4.0 Paper, plus Feedback and Samples</title><link>http://blogs.msdn.com/charlie/archive/2008/11/04/new-features-in-c-4-0-paper-plus-feedback-and-samples.aspx</link><pubDate>Wed, 05 Nov 2008 02:24:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9042036</guid><dc:creator>Charlie Calvert</dc:creator><slash:comments>64</slash:comments><comments>http://blogs.msdn.com/charlie/comments/9042036.aspx</comments><wfw:commentRss>http://blogs.msdn.com/charlie/commentrss.aspx?PostID=9042036</wfw:commentRss><description>&lt;p&gt;Mads Torgersen, a C# PM and member of the C# design team, has worked with other members of the C# team to create a &lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3550"&gt;document&lt;/a&gt; that outlines the new features in C# 4.0. Along with &lt;a href="http://channel9.msdn.com/pdc2008/TL16/"&gt;Anders’ PDC talk&lt;/a&gt;, this is probably the best way to get an overview of what the C# team has planned for the next release of the language. I also want to make sure you know about the C# 4.0 &lt;a href="https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=csharpfuture&amp;amp;ReleaseId=1686&amp;amp;wa=wsignin1.0"&gt;samples&lt;/a&gt;. These short projects are designed to demonstrate how to use the new language features in C# 4.0. Finally, I provide a link to the Visual Studio 2010 CTP &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vs2010ctpvbcs/threads/"&gt;forums based feedback area&lt;/a&gt;, where you can comment on the new features Microsoft has planned for the C# language and the VS IDE. These forums provide a place where you can provide the PM’s who are driving the new features in VS 2010 with your valued feedback.&lt;/p&gt;  &lt;p&gt;Here are the links to the:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/csharpfuture"&gt;Code Gallery C# Future Site&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=csharpfuture&amp;amp;ReleaseId=1686&amp;amp;wa=wsignin1.0"&gt;Downloads Page on the Future Site&lt;/a&gt;&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here are direct links to&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3550"&gt;Mads’ New Features in C# 4.0 Paper&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3540"&gt;Dynamic Samples&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3541"&gt;Covariance and Contravariance Sample&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3575"&gt;IDynamicObject Sample&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vs2010ctpvbcs/threads/"&gt;The CTP Feedback Forums&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Except for the CTP Feedback Forums, all the items listed above are found on the Code Gallery based &lt;a href="http://code.msdn.microsoft.com/csharpfuture"&gt;C# Future site&lt;/a&gt;. That site provides a single nexus of information where you can learn about our plans for the next version of the C# language.&lt;/p&gt; &lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2008%2f11%2f04%2fnew-features-in-c-4-0-paper-plus-feedback-and-samples.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.msdn.com%2fcharlie%2farchive%2f2008%2f11%2f04%2fnew-features-in-c-4-0-paper-plus-feedback-and-samples.aspx" border="0" /&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9042036" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/charlie/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/charlie/archive/tags/Dynamic/default.aspx">Dynamic</category><category domain="http://blogs.msdn.com/charlie/archive/tags/C_2300_+4.0/default.aspx">C# 4.0</category></item></channel></rss>