 Hi, I'm Kasey Ulinhoo, a Program Manager on the .NET Managed Languages team. I'm excited to show you what we've been working on for Update 1, notably the resurrection of the C-Sharp interactive window. The interactive window is a REPL, or a read-eval print loop, that lets you play with APIs, learn new language features, and experiment with .NET technologies. What makes the interactive window better than the standard REPL is that it takes advantage of the editor experience inside Visual Studio to provide an intelligent environment for learning and iteratively developing. In this video, I'll first talk about what a REPL is. I'll then show a demo of how you can use the interactive window today in Visual Studio 2015 Update 1 to quickly learn APIs. And finally, we'll take a look at the command line script execution engine in REPL, CSI. First, let's talk about what a REPL, or a read-eval print loop, is. A REPL is an interactive environment that evaluates your code snippets and provides you with immediate feedback on your input's results. The classic example is to show a REPL is essentially a glorified calculator. So I can type a mathematical expression and immediately see the output of result. We can also do the classic hello world by writing the line and typing the string hello world. The interesting thing to note here is that we didn't have to define a namespace or open up a console app in order to dig our hands into experimenting with C-sharp. In fact, the interactive window supports an interactive flavor of C-sharp that allows users to define things at the top level that we couldn't do in C-sharp proper. For example, I can now add methods directly at the top level inside the interactive window. For example, this method is just going to add two to a given integer. I can see this method pop up in IntelliSense, I can give it an input, and I can see the correctly outputted result. An important scenario the interactive window addresses is experimenting with APIs. I'm now going to walk through an interactive session where I'm going to learn how to use the GitHub Octokit API and show off certain interactive features along the way. The Octokit library lets you interact with the GitHub repo. What I want to do in this demo is print all the community members who got pull requests merged into the .NET Roslin repo over the last two weeks. The first thing I'm going to do is reference the package. Unfortunately, the interactive window does not have Nougat support in Update 1, but this feature should be coming soon. For now, I can directly reference the DLL for the Octokit library on my local machine using the directive pound R. I can now copy the source path on my local machine and reference the DLL. I can now go and do what many of us do when we're first learning API and copy a sample from the internet. So I can go to the Octokit documentation page, copy a code snippet, and paste it inside my interactive window. I can see that I'm getting a red squiggle now under GitHub Client. If I hover over, I can see that it says the type or namespace name GitHub Client could not be found and it suggests that maybe I'm missing a using directive. I also can see a light bulb has appeared, which from the editor we know is a quick action tip. If I click on this, I can see that it's actually suggesting that I add the directive Octokit to my submission. If I click this, I can see it's pre-pending my submission with the using directive, now making it valid. If I submit it, I'm getting the correctly outputted result. Now let's say I figure out how to do OAuth with Octokit. I can now use the interactive feature pound load to load the script file I have created that does this OAuth for me. So I can type pound load and I can use the IntelliSense for file directories to actually help me find this file. When I load the script, I have now seeded my interactive session with a new execution context and I can access any of the variables that were inside this script. So inside the script, I had a client, which was a GitHub client, which I can now play around with to figure out how I can get all my pull requests from the Roslyn repo. So if I play around IntelliSense, I can see there's this get all for repository and it's going to take an owner and a name for the repository. So the owner of Roslyn is .net and the repository name is Roslyn. When I evaluate this, I can actually see that it's returning a task, meaning I should have awaited it. So I can now type a variable pull request, add my await keyword and a neat feature that you can do is navigate up to your previous submission, click control enter, and it's going to append that submission to my current one. I now want to filter out my pull requests to only get those that were done in the last two weeks. So I can write a query and use link to filter these out. So I want to do it where and you can see again, I'm getting IntelliSense, I see there's a created at where I've done this in the last two weeks. So from two weeks from now, we're going to subtract 14 days, which would be two weeks. I can now write a for each loop that is going to go through all the pull requests in this query. And it's going to print them. So I can do console dot right line. And I can actually use the string interpolation feature and C sharp six inside the interactive window to print this out. So I want to print out the date. I want to print out the name of the person that submitted the pull request. And I want to print out the pull request title. If I evaluate this, I can now see all of the people who submitted pull requests in the last two weeks to the Roslin repo. If I look through this, I see a lot of Microsoft employees. So I actually want to filter them out. I'm not quite sure how to do this. But again, I can play around with IntelliSense. I can see there's a concept of an organization. So I'm going to dig into that a little bit. And I can see organizations have members. And I can actually, it looks like check a member. If I have the organization name and the string of the user login, I can actually figure out if someone's a member. So I can type Microsoft. And then I can check my own name and see if I'm a member of the Microsoft organization. We can see here again that I actually needed to await this. So I can use the control enter technique I mentioned before. And I can see this returns true. Now let's check if someone that I know is not in the Microsoft organization is part of this. To do this, I can actually use alt up, which navigates the history of commands. So I'm going to use alt up to get to my history. And now I'm going to try and see if hacked is actually part of the Microsoft organization on GitHub. And it correctly returns false. So this is exactly what I need. Again, using the navigating history, I can bring back up my for each loop. And now I actually want to find out who the internal members are. So we want to see if this is an internal member. And I'm going to use what I just learned to find if they're a member of the Microsoft organization, Microsoft, and then we're going to take the user login. I'm now going to check if they are an internal member. And if they're not, I'm going to print them out. If I now evaluate this, I can see I'm only getting community members who have submitted pull requests in the last two weeks to the Ross and repository. I've essentially now iteratively developed a script inside the interactive window. I can now copy paste my snippets from the interactive window into a script file and run this file. If I don't want to open Visual Studio to run a quick script, I can actually use the command line script execution engine called CSI. I can access CSI from the developer command prompt. Once I open this up, I can now type the command CSI, followed by the path to my script file. Once I type this in, I click enter and it's going to actually run my script file. And the outputs are going to show directly up in the developer command prompt. And again, I can see the exact same community members who's committed to Roslyn in the last two weeks. I can also access the REPL from the command line. To do that, I just type CSI and then I'm dropped into an interactive session from the command line. To be a little fun, I wrote a small app using Windows forms that I can now write directly from the REPL. If I click enter to evaluate this last statement that's going to show a dialogue, I can see that I have actually created a Windows form app from the command line, which is pretty cool. This was a quick illustration of how you can use the interactive window and command line engine in REPL to learn APIs and iteratively develop in C-Sharp. If you want to learn more features of the interactive window, visit our GitHub Wiki page at the link to the left. Thanks for watching and have fun exploring with C-Sharp.