Jupyter Notebook is popular platform to write and execute your code. However, not many C# developer use it as we have Visual Studio as our preferred IDE.
However, according to Introducing the Jupyter Extension for VS Code article, VS Code start supporting Jupyter Notebook more and more these days. So it's time to try C# on Jupyter Notebook.
.NET Interactive Notebooks is an extension for VS Code, and it's easy to start using with 3 steps.
1. Install Visual Studio Code Insiders as it's preview feature at the moment. By the time you read this article, it would be included in normal VS Code though.
2. Install .NET Core SDK, which I believe all C# developer already have. The official page says to install .NET Core 3.1.
3. Install .NET Interactive Notebooks extension.
Just restart VS code to complete the installation.
Now you're ready to use it. Go to command palette and select "Create new blank notebook"
It may take a bit of time for initial notebook creation, so just wait until you see new notebook. Once it's ready, you see the notebook like below.
Type your code and execute by either click arrow icon or Shift+Enter.
Of course you can define class and use it.
.NET 5 GA this week! Yay! But the extension supports .NET Core 3.1 at the moment. Let's wait until it support .NET 5. Check GitHub issue for more detail. I cannot wait to try Record type in notebook :)
Yes, the extension supports various other dotnet related languages.
For example, you can write and execute PowerShell as well :)