Show Your .NET Code Effectively With Jupyter Notebook

Jung-Hyun Nam
Nov 23, 2020 · 3 min read
Image for post
Image for post
You can show your .NET code as a presentation with Jupyter Notebook, .NET Interactive.

The precious .NET 5 has finally arrived in our workspace, and I’m thrilled. .NET 5 is a unified and cross-platform supported runtime for C# and F# developers. Also, it has balanced cross-platform features across all environments, including existing your old familiar Windows desktop environment and Linux, Cloud-native, macOS, even machine learning, Apache Spark, and Web Assembly.

I’m recently taking a series of the episode called the Azure Playlists project in cooperation with Microsoft Korea. I thought a lot about how to present my PowerShell code to viewers effectively. After many trials and errors, I got a neat but simple idea.

With the release of .NET 5, Microsoft also launches many useful tools as open-source projects. .NET Interactive is one-of-them, and I found it.

.NET Interactive provides three types of .NET kernels, C#, F#, and PowerShell. I used PowerShell to introduce Azure related tools. Because PowerShell works almost the same across all three OSes (including Windows, Linux, and macOS). With .NET Interactive, I can reuse my existing knowledge to Jupyter notebook without any hassle.

Image for post
Image for post
C#, F#, and PowerShell supported!

As you already know, the Jupyter notebook can contain the runnable code and its results to understand its meaning and how it works. This time, you can replace your code with C#, F#, or PowerShell.

You can bring your notebook anywhere and any operating system because the Anaconda and .NET 5 supports all major operating systems. If you already installed these two components, you can follow the commands below.

After you installed the .NET Interactive successfully, you can verify your installation with the command below.

Then, create a new notebook with your shiny-new .NET interactive kernel. For example, I made a notebook with the PowerShell kernel.

Image for post
Image for post
You can use the PowerShell code in your notebook.

Verify your code and save the notebook. Then, you already know how to display each cell as a presentation slide, right? Let’s see it.

(For starters, you can follow the link that describes how to convert each notebook’s cell into a slide.)

Presenting Code Using Jupyter Notebook Slides | by Matthew Speck | Medium

Image for post
Image for post
Presenting Your PowerShell Code With RISE

Voila! You can deliver your notebook anywhere.

Recently, I’m writing a tutorial for C# starters with Jupyter notebook and mkdocs. The mkdocs can include the Jupyter notebook file as a page and provide a download link. Anyone can install the Anaconda, .NET 5, and .NET interactive; many starters can easily use the notebook file to learn .NET languages effectively.

Take the time to look around it!

DataSeries

Imagine the future of data

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store