Friday, 13 July 2012

Interactive C# Microsoft Roslyn

Microsoft Roslyn CTP adds Interactive C# window to Visual Studio 2010/2012 and adds support for scripting and interactive use of C#

roslyn1

It also allows you to write script files *.csx

roslyn2

The easiest way to initialize C# Interactive window is to right click on any C# project and choose 'Reset Interactive from Project' from context menu

roslyn3

Then you can execute any C# code from your project

public class Sample
{
    public List<string> Run()
    {
        return new List<string>(){"One","Two","Three","Four"};
    }
}

roslyn4

To execute script use #load command

roslyn5

Other useful commands

#r ".\myproject.exe"  //loads executable or dll
#load ".\setup.csx"   //loads script

And this is good introduction to Microsoft “Roslyn”

No comments:

Post a Comment