diff --git a/Docs/assets/images/NugetUI.jpg b/Docs/assets/images/NugetUI.jpg
new file mode 100644
index 0000000..b76d9b5
Binary files /dev/null and b/Docs/assets/images/NugetUI.jpg differ
diff --git a/Docs/assets/images/使用WebApi.jpg b/Docs/assets/images/使用WebApi.jpg
new file mode 100644
index 0000000..c965396
Binary files /dev/null and b/Docs/assets/images/使用WebApi.jpg differ
diff --git a/Docs/assets/images/多语言笔记-模板.jpg b/Docs/assets/images/多语言笔记-模板.jpg
new file mode 100644
index 0000000..2e9b57b
Binary files /dev/null and b/Docs/assets/images/多语言笔记-模板.jpg differ
diff --git a/Docs/assets/images/多语言笔记.psd b/Docs/assets/images/多语言笔记.psd
new file mode 100644
index 0000000..bd77fab
Binary files /dev/null and b/Docs/assets/images/多语言笔记.psd differ
diff --git a/Docs/assets/images/管理nuget包.jpg b/Docs/assets/images/管理nuget包.jpg
new file mode 100644
index 0000000..92533f5
Binary files /dev/null and b/Docs/assets/images/管理nuget包.jpg differ
diff --git a/Docs/多语言笔记.1.1.入门说明.md b/Docs/多语言笔记.1.1.入门说明.md
new file mode 100644
index 0000000..020c45e
--- /dev/null
+++ b/Docs/多语言笔记.1.1.入门说明.md
@@ -0,0 +1,137 @@
+Jupyter笔记 简单入门
+==============================
+使用 Jupyter NoteBook 形式,优点是代码执行和 Markdown 文档放在同一个文件中,并可以交替显示和分段执行代码。
+## 显式声明使用 C# 语言
++ csharp
++ fsharp
++ pwsh
+```csharp
+#!csharp
+```
+## C# 中的引用
++ 导入程序文件
+ > 可以导入多种文件,包括 .cs .csc .fc .js等,语法为` #!import /path/to/file `
++ 引用本机 Dll 文件
+ > 可以导入本机编译好的dll文件,语法为 `#!import /path/to/file`
++ 引用 Nuget 包
++ > 默认包源下,可以导入nuget,当然也可以设置包源,语法为 `#r 包名,可选版本号`
+## C# 中的引用
++ 导入程序文件
+ > 可以导入多种文件,包括 .cs .csc .fc .js等,语法为` #!import /path/to/file `
+```csharp
+#! import "../NotebookStudy.ConsoleApp/Persion.cs"
+```
+```csharp
+//单纯引用.cs文件,不能直接使用,解决方法待查找
+var p = new Person()
+{
+ Id=1,
+ Name="小张",
+ Address="上海无名路1号",
+ Age = 28
+};
+//在NoteBook中,可以格式化显示(Notebook提供) C#对象:使用 display(对象); 如果在代码结尾的话,可以直接写 C#对象。
+display(p);
+
+//代码结尾的话,直接写 对象
+p
+```
+```csharp
+var x = new {Name="xx",Agx=33};
+display(x);
+```
++ 引用本机 Dll 文件
+ > 可以导入本机编译好的dll文件,语法为 `#!import /path/to/file`
+```csharp
+//如果找不到文件,需要先生成 NotebookStudy.ConsoleApp 项目
+
+#r "../NotebookStudy.ConsoleApp/bin/Debug/net7.0/NotebookStudy.ConsoleApp.dll"
+
+using NotebookStudy.ConsoleApp;
+
+var personA= new Person()
+{
+ Id=2,
+ Name="本山",
+ Age=55
+};
+
+personA
+```
++ 引用 Nuget 包
+```csharp
+//安装库的最新版本
+#r "nuget:newtonsoft.json"
+var jsonObj = new {Id=2,Name="newtonsoft类库", Age=6};
+
+//使用库
+var jsonText = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj);
+jsonText
+```
+```csharp
+//安装库的指定版本
+#r "nuget:System.Text.Json,4.7.2"
+
+//使用库
+var jsonObj2 = new {Id=2,Name="System.Text.Json类库", Age=6};
+var jsonText2 = System.Text.Json.JsonSerializer.Serialize(jsonObj2);
+jsonText2
+```
+```csharp
+//安装最新的预览版库
+#r "nuget:xunit,*-*"
+
+using Xunit;
+using Xunit.Abstractions;
+using Xunit.Sdk;
+
+public class UnitTest1
+{
+ [Fact]
+ public void Test1()
+ {
+ Assert.True(true, "xxxx");
+ }
+}
+```
+## Nuget 包源管理
+
++ 在线包源
+ > 默认包源:https://api.nuget.org/v3/index.json 使用默认包源的话,可以不添加包源引用。当然也可以添加。
+```csharp
+//添加包源:可以添加多个
+#i "nuget:https://api.nuget.org/v3/index.json"
+```
+```csharp
+//使用包源
+
+#r "nuget:AutoFixture.Xunit2"
+```
++ 本机包源 Nuget
+```csharp
+//添加本地包源
+#i "nuget:C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\"
+
+//使用包源
+#r "nuget:xunit"
+
+```
++ 经过身份验证的Nuget包源
+ > 不能直接引用验证包源,可以通过将源的 PAT 放入用户级 nuget.config 文件来访问经过身份验证的源
+## 内建魔术命令
++ #!about 显示有关内核版本的信息
+```csharp
+#!about
+```
++ #!lsmagic 列出可用的魔术命令,包括可能已通过扩展安装的命令
+```csharp
+#!lsmagic
+```
++ #!time 显示执行时间
+```csharp
+#!time
+```
++ -h 参数 显示命令的帮助信息
+```csharp
+#!time -h
+```
diff --git a/Docs/多语言笔记.1.4.使用NuGet包.ipynb b/Docs/多语言笔记.1.4.使用NuGet包.ipynb
deleted file mode 100644
index e78ba35..0000000
--- a/Docs/多语言笔记.1.4.使用NuGet包.ipynb
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "id": "065bfcac",
- "metadata": {
- "polyglot_notebook": {
- "kernelName": "csharp"
- }
- },
- "source": [
- "使用NuGet包\n",
- "==========="
- ]
- }
- ],
- "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
-}
diff --git a/Docs/多语言笔记.1.4.管理NuGet包.ipynb b/Docs/多语言笔记.1.4.管理NuGet包.ipynb
new file mode 100644
index 0000000..f3df961
--- /dev/null
+++ b/Docs/多语言笔记.1.4.管理NuGet包.ipynb
@@ -0,0 +1,324 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "065bfcac",
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "source": [
+ "管理NuGet包\n",
+ "==========="
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0baca368",
+ "metadata": {},
+ "source": [
+ "## 浏览和查找NuGet包"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "18559f3e",
+ "metadata": {},
+ "source": [
+ "VS Code 提供了查看和查找NuGet包的UI界面:打开一个`Polyglot Notebook`文件,打开一个\"终端\", 切换到 \"nuget\"项:打开一个UI管理窗口。如下图:\n",
+ "\n",
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c110c37f",
+ "metadata": {},
+ "source": [
+ "## 导入 NuGet 包"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7eecdf67",
+ "metadata": {},
+ "source": [
+ "在`.NET Interactive`中,C#和F#核允许你使用`#r nuget`魔法命令将NuGet包导入到你的交互式会话中。两种语言的语法相同。"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "73546727",
+ "metadata": {},
+ "source": [
+ "+ 导入最新版本的包,使用` #r nuget` 而无需指定版本号:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "ede3455f",
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "#r \"nuget:Newtonsoft.Json\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{\"Name\":\"张三\",\"Age\":20},{\"Name\":\"李四\",\"Age\":69},{\"Name\":\"王五\",\"Age\":82}]\r\n"
+ ]
+ }
+ ],
+ "source": [
+ "//使用包:序列化一个匿名类集合\n",
+ "\n",
+ "//引入命名空间\n",
+ "using Newtonsoft.Json;\n",
+ "\n",
+ "{ //花括号分隔作用域\n",
+ " var persons = new[]\n",
+ " {\n",
+ " new {Name=\"张三\", Age = 20},\n",
+ " new {Name=\"李四\", Age = 69},\n",
+ " new {Name=\"王五\", Age = 82},\n",
+ " }; \n",
+ "\n",
+ " var jsonText = Newtonsoft.Json.JsonConvert.SerializeObject(persons);\n",
+ " Console.WriteLine(jsonText);\n",
+ "}\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "da4b55e2",
+ "metadata": {},
+ "source": [
+ "+ 导入指定版本的包"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "#r \"nuget:Newtonsoft.Json,13.0.3\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "07da3486",
+ "metadata": {},
+ "source": [
+ "+ 导入预览版本的包"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Restore sources- https://api.nuget.org/v3/index.json
Installed Packages- System.CommandLine, 2.0.0-beta4.22272.1
"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "#r \"nuget:System.CommandLine,*-*\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fe5a81be",
+ "metadata": {},
+ "source": [
+ "## 设置包源"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c8ce789d",
+ "metadata": {},
+ "source": [
+ "如果包不是Nuget官方托管包,或者想明确包的来源,使用`#i`命令指定一个nuget包源"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b2e11743",
+ "metadata": {},
+ "source": [
+ "+ 默认包源\n",
+ " 可以不用设置,默认使用的官方托管包"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Restore sources- https://api.nuget.org/v3/index.json
"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "//默认包源:可以不设置\n",
+ "#i \"nuget:https://api.nuget.org/v3/index.json\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "39096d0b",
+ "metadata": {},
+ "source": [
+ "+ 远程包源\n",
+ "\n",
+ " 组织通常会将包存储在私人或预发布源中"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Restore sources- https://api.nuget.org/v3/index.json
- https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "//添加dotnet项目的预发布nuget源\n",
+ "#i \"nuget:https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "134c7d97",
+ "metadata": {},
+ "source": [
+ "+ 本地包源\n",
+ "\n",
+ " 可以将一个本地文件夹作为nuget源"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "polyglot_notebook": {
+ "kernelName": "csharp"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "//\"C:\\Users\\用户账号\\.nuget\\packages\" 是 Windows 系统中 visual studio 默认的本机 nuget 包存储位置,可以当本地包源(注意路径用户账号换成自己的)\n",
+ "//当然可使用任意文件夹,里面要有nuget包\n",
+ "\n",
+ "#i \"nuget:C:\\Users\\ruyu\\.nuget\\packages\"\n",
+ "#r \"nuget:MyOrg.MyPackage\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "54d60e85",
+ "metadata": {},
+ "source": [
+ "+ 需要认证的包源\n",
+ "\n",
+ " 一些企业搭建有自己的nuget私有包服务器(MyGet等),使用时需要认证。\n",
+ "\n",
+ " 但是:.NET Interactive 不直接支持访问需要身份验证的包源,但你可以通过在用户级别的 nuget.config 文件中放入包源的 PAT 来访问经过身份验证的源。你可以在这里了解更多关于这种方法的信息"
+ ]
+ }
+ ],
+ "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
+}
diff --git a/Docs/多语言笔记.6.1.共享变量.ipynb b/Docs/多语言笔记.6.1.共享变量.ipynb
index b76ebc2..2a2588f 100644
--- a/Docs/多语言笔记.6.1.共享变量.ipynb
+++ b/Docs/多语言笔记.6.1.共享变量.ipynb
@@ -64,7 +64,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {
"polyglot_notebook": {
"kernelName": "csharp"
@@ -85,7 +85,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
@@ -94,14 +94,22 @@
"kernelName": "pwsh"
}
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "192.168.1.1\r\n"
+ ]
+ }
+ ],
"source": [
"# Poweshell中使用 前面C#单元中定义的变量\n",
"# 特别注意:因为PS中变量名必须以$开头,所以在命令中 name 参数名,在PS中使用时必须加$前辍\n",
"\n",
"#!set --value @csharp:getway --name gw\n",
"\n",
- "Write-Host $gw\n"
+ "Write-Host $gw"
]
},
{
@@ -113,7 +121,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {
"dotnet_interactive": {
"language": "fsharp"
@@ -122,11 +130,19 @@
"kernelName": "fsharp"
}
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "192.168.1.1\r\n"
+ ]
+ }
+ ],
"source": [
"#!set --value @csharp:getway --name getway\n",
"\n",
- "Console.WriteLine(getway)\n"
+ "Console.WriteLine(getway)"
]
},
{
@@ -147,10 +163,20 @@
"kernelName": "javascript"
}
},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "192.168.1.1"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
"#!set --value @csharp:getway --name getway\n",
- "console.log(getway);\n"
+ "console.log(getway);"
]
}
],