{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Verify execution count.\n", "\n", "The next code cell should have empty square brackets on the left, e.g., \"`[ ]`\". Execute the cell and upon completion there should be a number there; probably \"`[1]`\". Execute the cell again and verify that the number in the brackets increments by one, e.g., \"`[2]`\"." ] }, { "cell_type": "code", "execution_count": null, "id": "3c954261", "metadata": { "dotnet_interactive": { "language": "csharp" }, "polyglot_notebook": { "kernelName": "csharp" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "1+1" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Verify Completions.\n", "The next code cell contains the code `Console`. At the end type, `.`. The completions list with properties and methods should be displayed." ] }, { "cell_type": "code", "execution_count": null, "id": "a1beba1b", "metadata": { "dotnet_interactive": { "language": "csharp" }, "polyglot_notebook": { "kernelName": "csharp" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "Console" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Execute the following cell.\n", "\n", "You'll notice a counter that appears and starts incrementing. After a second or two, stop the cell. Your output should look similar to:\n", "\n", "```\n", "5\n", "Command cancelled\n", "```\n", "\n", "N.b., the old values (e.g., `1`, `2`, `3`, `4`, etc.) should no longer be displayed, but overwritten." ] }, { "cell_type": "code", "execution_count": null, "id": "607c08c8", "metadata": { "dotnet_interactive": { "language": "csharp" }, "polyglot_notebook": { "kernelName": "csharp" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "using System.Threading.Tasks;\n", "using Microsoft.DotNet.Interactive;\n", "\n", "var output = string.Empty.Display(\"text/plain\");\n", "var counter = 1;\n", "while (!KernelInvocationContext.Current.CancellationToken.IsCancellationRequested)\n", "{\n", " await Task.Delay(500, KernelInvocationContext.Current.CancellationToken);\n", " output.Update($\"{counter++}\");\n", "}" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Execute the next two cells." ] }, { "cell_type": "code", "execution_count": null, "id": "4840a9c4", "metadata": { "dotnet_interactive": { "language": "csharp" }, "polyglot_notebook": { "kernelName": "csharp" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "var x = 123;" ] }, { "cell_type": "code", "execution_count": null, "id": "5575d228", "metadata": { "dotnet_interactive": { "language": "html" }, "polyglot_notebook": { "kernelName": "html" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "
2