{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8b314faa",
   "metadata": {},
   "source": [
    ".NET Interactive 使用方式\n",
    "========================"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6bf06d6d",
   "metadata": {},
   "source": [
    ".NET Interactive生态,大约由:前端UI(Jupyter、VSCode等)、交互协议(PMP、JMP)、执行器(.net interactive)和语言服务组成。\n",
    "\n",
    "![生态](./assets/images/Framework.png)\n",
    "\n",
    "有多种组合方式,来使用。最常用的还是 VS Code(Polyglot Notebooks插件)充当前端UI,调用  .net interactive 执行器。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0bd5f553",
   "metadata": {},
   "source": [
    "## `VS Code` 配合 `Polyglot Notebooks`插件"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aacf21bd",
   "metadata": {},
   "source": [
    "这是最常用的、功能最丰富的使用方式。\n",
    "\n",
    "![VS Code UI](./assets/images/使用方式-VSCode.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a4483f2d",
   "metadata": {},
   "source": [
    "## 使用为 `Jupyter kernel`"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "267be322",
   "metadata": {},
   "source": [
    "通过设置Jupyter服务(把.net interactive安装成Jupyte插件),使用 Jupyter笔记本,直接支持C#、F#、Powershell语言。\n",
    "\n",
    "![Jupyter](./assets/images/使用方式-Jupyter1.jpg)\n",
    "\n",
    "![Jupyter](./assets/images/使用方式-Jupyter2.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9174543b",
   "metadata": {},
   "source": [
    "## nteract 简单UI客户端"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3efc71a3",
   "metadata": {},
   "source": [
    "[nteract](https://nteract.io/) 是另一个可视化UI应用。并且提供了 CoreSdk开发库,能在应用中直接使用 .net interactive 库。\n",
    "\n",
    "下载,安装后,直接使用。官网 https://nteract.io\n",
    "\n",
    "![nteract](./assets/images/使用方式-nteract.jpg)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e613e55b",
   "metadata": {},
   "source": [
    "## `dotnet-repl` 交互式命令行"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2505ac35",
   "metadata": {},
   "source": [
    "[dotnet-repl](https://github.com/jonsequitur/dotnet-repl) 项目是一个实验项目,使用 .NET Interactive / Polyglot Notebooks 和 Spectre.Console 创建多语言 .NET REPL 以在命令行上使用。\n",
    "\n",
    "实质上是一个 .net tool\n",
    "\n",
    "[官网](https://github.com/jonsequitur/dotnet-repl)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "68afc987",
   "metadata": {},
   "source": [
    "+ 安装"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "polyglot_notebook": {
     "kernelName": "pwsh"
    }
   },
   "outputs": [],
   "source": [
    "dotnet tool install -g dotnet-repl"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "69aceca8",
   "metadata": {},
   "source": [
    "+ 单行命令"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "12770923",
   "metadata": {},
   "source": [
    "![REPL](./assets/images/使用方式-REPL-1.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a91a9af",
   "metadata": {},
   "source": [
    "+ 多行命令"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85d29f2f",
   "metadata": {},
   "source": [
    "![REPL](./assets/images/使用方式-REPL-2.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bbae9984",
   "metadata": {},
   "source": [
    "+ 执行笔记本文件"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6cdaf093",
   "metadata": {},
   "source": [
    "![REPL](./assets/images/使用方式-REPL-3.jpg)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "csharp",
    "items": [
     {
      "aliases": [],
      "languageName": "csharp",
      "name": "csharp"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}