整理、更新

master
bicijinlian 1 day ago
parent a4cf579a6a
commit 95f9fd0c5b

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
@ -428,7 +428,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
@ -437,7 +437,16 @@
"kernelName": "csharp"
}
},
"outputs": [],
"outputs": [
{
"ename": "Error",
"evalue": "(1,8): error DNI103: Unrecognized parameter name '-h'",
"output_type": "error",
"traceback": [
"(1,8): error DNI103: Unrecognized parameter name '-h'"
]
}
],
"source": [
"#!time -h"
]

@ -131,7 +131,7 @@
{
"data": {
"text/html": [
"<details open=\"open\" class=\"dni-treeview\"><summary><span class=\"dni-code-hint\"><code>{ Name = 张三, Age = 33, Adress = 河南周口 }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Name</td><td>张三</td></tr><tr><td>Age</td><td><div class=\"dni-plaintext\"><pre>33</pre></div></td></tr><tr><td>Adress</td><td>河南周口</td></tr></tbody></table></div></details><style>\r\n",
"<details open=\"open\" class=\"dni-treeview\"><summary><span class=\"dni-code-hint\"><code>{ Name = 张三, Age = 33, Adress = 河南周口 }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Name</td><td><div class=\"dni-plaintext\"><pre>张三</pre></div></td></tr><tr><td>Age</td><td><div class=\"dni-plaintext\"><pre>33</pre></div></td></tr><tr><td>Adress</td><td><div class=\"dni-plaintext\"><pre>河南周口</pre></div></td></tr></tbody></table></div></details><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
@ -171,7 +171,7 @@
{
"data": {
"text/html": [
"<details open=\"open\" class=\"dni-treeview\"><summary><span class=\"dni-code-hint\"><code>{ Name = 张三, Age = 33, Adress = 河南周口 }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Name</td><td>张三</td></tr><tr><td>Age</td><td><div class=\"dni-plaintext\"><pre>33</pre></div></td></tr><tr><td>Adress</td><td>河南周口</td></tr></tbody></table></div></details><style>\r\n",
"<details open=\"open\" class=\"dni-treeview\"><summary><span class=\"dni-code-hint\"><code>{ Name = 张三, Age = 33, Adress = 河南周口 }</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Name</td><td><div class=\"dni-plaintext\"><pre>张三</pre></div></td></tr><tr><td>Age</td><td><div class=\"dni-plaintext\"><pre>33</pre></div></td></tr><tr><td>Adress</td><td><div class=\"dni-plaintext\"><pre>河南周口</pre></div></td></tr></tbody></table></div></details><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
@ -228,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
@ -350,7 +350,7 @@
{
"data": {
"text/html": [
"<span>2023-04-04 12:27:28Z</span>"
"<span>2025-04-20 18:16:02Z</span>"
]
},
"metadata": {},
@ -368,10 +368,26 @@
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"name": "python"
},
"orig_nbformat": 4
"orig_nbformat": 4,
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2

@ -27,90 +27,7 @@
"kernelName": "csharp"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div><div><strong>Restore sources</strong><ul><li><span>https://api.nuget.org/v3/index.json</span></li></ul></div><div></div><div><strong>Installed Packages</strong><ul><li><span>microsoft.dotNet.interactive.aspnetcore, 1.0.0-beta.25177.1</span></li><li><span>Microsoft.DotNet.Interactive.ExtensionLab, 1.0.0-beta.25177.1</span></li></ul></div></div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"Loading extensions from `C:\\Users\\ruyu\\.nuget\\packages\\microsoft.data.analysis\\0.22.0\\interactive-extensions\\dotnet\\Microsoft.Data.Analysis.Interactive.dll`"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"Loading extension script from `C:\\Users\\ruyu\\.nuget\\packages\\microsoft.dotnet.interactive.aspnetcore\\1.0.0-beta.25177.1\\interactive-extensions\\dotnet\\extension.dib`"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"Loading extension script from `C:\\Users\\ruyu\\.nuget\\packages\\microsoft.dotnet.interactive.extensionlab\\1.0.0-beta.25177.1\\interactive-extensions\\dotnet\\extension.dib`"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<details><summary>Create strongly-typed dataframes using<code>#!linqify</code>.</summary>\r\n",
" <p>The <code>#!linqify</code> magic command replaces a <a href=\"https://www.nuget.org/packages/Microsoft.Data.Analysis/\"><code>Microsoft.Data.Analysis.DataFrame</code></a> variable with a generated, strongly-typed data frame, allowing the use of LINQ operations over the contained data.</p>\r\n",
" </details>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<details><summary>ExplainCode</summary>\r\n",
" <p>This extension generates Sequence diagrams from csharp code using Mermaid kernel.</p>\r\n",
" </details>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<details><summary>Inspect code compilation details using the <code>#!inspect</code> magic command.</summary>\r\n",
" <p>The <code>#!inspect</code> magic command allows you to see the C# decompilation, IL, and JIT Asm for the code in a C# cell.</p>\r\n",
" <img src=\"https://user-images.githubusercontent.com/547415/109560515-d5749a00-7a90-11eb-9fa3-51b737345bb4.png\" width=\"75%\" />\r\n",
" </details>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<details><summary>Use the <code>#!record</code> magic command to keep a transcript of the code you run.</summary>\r\n",
" <p>Once you enable transcripts using <code>#!record</code>, each code submission (including re-running cells) is recorded in the specified file. The JSON format used is the same format recognized by the .NET Interactive <code>stdio</code> and <code>http</code> APIs and can be used to replay an interactive session via automation.</p>\r\n",
" <img src=\"https://user-images.githubusercontent.com/547415/109562409-343b1300-7a93-11eb-8ebf-79bb6af028cf.png\" width=\"75%\" />\r\n",
" </details>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"// 默认包源\n",
"#i \"nuget:https://api.nuget.org/v3/index.json\"\n",
@ -133,6 +50,64 @@
"source": [
"## 测试"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Description:\n",
" .NET 的交互式编程。\n",
"\n",
"Usage:\n",
" dotnet-interactive [command] [options]\n",
"\n",
"Options:\n",
" --log-path <log-path> 启用文档日志到指定目录\n",
" --verbose 启用详细记录至控制台\n",
" --version Show version information\n",
" -?, -h, --help Show help and usage information\n",
"\n",
"Commands:\n",
" jupyter <connection-file> 启动 dotnet-interactive 作为 Jupyter 内核\n",
" stdio 使用通过标准 I/O 公开的内核功能启动 dotnet 交互\n",
" notebook-parser 启动分析和序列化笔记本的进程。\n",
"\n"
]
}
],
"source": [
"dotnet interactive --help"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074\r\n"
]
}
],
"source": [
"dotnet interactive --version\n"
]
}
],
"metadata": {

File diff suppressed because one or more lines are too long

@ -124,16 +124,35 @@
"kernelName": "csharp"
}
},
"outputs": [],
"outputs": [
{
"data": {
"text/markdown": [
"The `#!connect jupyter` feature is in preview. Please report any feedback or issues at https://github.com/dotnet/interactive/issues/new/choose."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"Kernel added: #!pythonkernel2"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"using Microsoft.DotNet.Interactive;\n",
"using Microsoft.DotNet.Interactive.Commands;\n",
"\n",
"//引入Python内核使用C# 执行引入语句\n",
"if(Kernel.Root.FindKernelByName(\"pythonkernel\") == null)\n",
"if(Kernel.Root.FindKernelByName(\"pythonkernel2\") == null)\n",
"{\n",
" //Console.WriteLine(\"正在导入Python内核....\");\n",
" var importPythonkernel = \"#!connect jupyter --kernel-name pythonkernel --kernel-spec python3\";\n",
" var importPythonkernel = \"#!connect jupyter --kernel-name pythonkernel2 --kernel-spec python3\";\n",
" await Kernel.Root.SendAsync(new SubmitCode( importPythonkernel, \"csharp\"));\n",
" //Console.WriteLine(\"Python内核导入完成\");\n",
"}\n",
@ -177,7 +196,7 @@
],
"source": [
"# 明确指定内核:优先级高于 \"单元格选择的内核\"\n",
"#!pythonkernel\n",
"#!pythonkernel2\n",
"\n",
"print(\"你好,我是 Ployglot Notebooks 使用 Python语言内核打印的内容\")"
]
@ -187,7 +206,7 @@
"execution_count": 4,
"metadata": {
"polyglot_notebook": {
"kernelName": "pythonkernel"
"kernelName": "pythonkernel2"
}
},
"outputs": [
@ -203,17 +222,6 @@
"# 右下方选择 内核\n",
"print(\"右下方选择Python内核\");"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"polyglot_notebook": {
"kernelName": "pythonkernel"
}
},
"outputs": [],
"source": []
}
],
"metadata": {

Loading…
Cancel
Save