1. noun analysis
- interactive
Interactive means that you can directly run the code after entering the code, and then continue to enter the running code.
- Interactive. Net
.Net 是一种编译型语言,不像 python 这类的脚本型语言,可以边输入代码边运行结果。幸运的是,软微推出了 interactive 这个项目,使交互式 .Net 成为可能。
- The role of interactive. Net
交互式 .Net 可以解析 markdown,执行本地指令,如 powershell,执行 .Net 代码,因此,非常适用于教案编写,或者关键代码记录。并且生成的 ipynb 文件可上传到 GitHub 等平台,非常方便查阅。
2. installation settings
需要先安装 Visual Studio Code 和 .NET 5 及以上版本,然后在 Visual Studio Code 中安装 .NET Interactive Notebooks 插件,可以在 Visual Studio Code 中搜索 .NET Interactive Notebooks 进行安装:

3. use of presentation
- New Interaction
使用热键 Ctrl+Shift+P,然后选择 .NET Interactive: Create new blank notebook`

或者直接使用热键 Ctrl+Shift+Alt+N,然后选择 Create as '.ipynb'

开发语言选 C#

- Analyze Markdown
输入一段 markdown 内容,并在右下角选择 Markdown

使用热键 Alt+Enter 查看结果

- Executing C#code
输入一段 C# 代码,并在右下角选择 C#

使用热键 Alt+Enter 或者点击左边的“运行”按钮查看运行结果

可以通过 using 关键字引用相关依赖

- execute a native instruction
输入一段本地指令,并在右下角选择 PowerShell,使用热键 Alt+Enter 或者点击左边的“运行”按钮查看运行结果

- Get the. Net version through code

- Save ipynb file and upload it to GitHub
使用热键 Ctrl+S 把 ipynb 文件保存到本地,以后可以使用 Visual Studio Code 打开查看并重新运行代码

然后把 ipynb 文件上传到 GitHub

可以通过 https://github.com/ErikXu/Blogs/blob/master/ipynb/dotnet-interactive.ipynb 查看示例
4. Reference summary
以上就是本文希望分享的内容,其中 interactive 的 GitHub 地址为:https://github.com/dotnet/interactive
If you have any questions, you are welcome to leave a message and communicate on the public account.