|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": { |
| 7 | + "dotnet_interactive": { |
| 8 | + "language": "csharp" |
| 9 | + }, |
| 10 | + "vscode": { |
| 11 | + "languageId": "dotnet-interactive.csharp" |
| 12 | + } |
| 13 | + }, |
| 14 | + "outputs": [ |
| 15 | + { |
| 16 | + "data": { |
| 17 | + "text/html": [ |
| 18 | + "<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>System.Net.Http.Json, 6.0.0</span></li></ul></div></div>" |
| 19 | + ] |
| 20 | + }, |
| 21 | + "metadata": {}, |
| 22 | + "output_type": "display_data" |
| 23 | + } |
| 24 | + ], |
| 25 | + "source": [ |
| 26 | + "#r \"nuget: System.Net.Http.Json, 6.0.0\"" |
| 27 | + ] |
| 28 | + }, |
| 29 | + { |
| 30 | + "cell_type": "code", |
| 31 | + "execution_count": null, |
| 32 | + "metadata": { |
| 33 | + "dotnet_interactive": { |
| 34 | + "language": "csharp" |
| 35 | + }, |
| 36 | + "vscode": { |
| 37 | + "languageId": "dotnet-interactive.csharp" |
| 38 | + } |
| 39 | + }, |
| 40 | + "outputs": [ |
| 41 | + { |
| 42 | + "ename": "Error", |
| 43 | + "evalue": "(2,23): error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)\r\n(6,16): error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)", |
| 44 | + "output_type": "error", |
| 45 | + "traceback": [ |
| 46 | + "(2,23): error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)\r\n", |
| 47 | + "(6,16): error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)" |
| 48 | + ] |
| 49 | + } |
| 50 | + ], |
| 51 | + "source": [ |
| 52 | + "using System.Net.Http;\n", |
| 53 | + "using System.Net.Http.Json;\n", |
| 54 | + "\n", |
| 55 | + "var message = new HttpRequestMessage(HttpMethod.Post, \"http://postman-echo.com/post\")\n", |
| 56 | + "{\n", |
| 57 | + " Content = System.Net.Http.Json.JsonContent.Create(new\n", |
| 58 | + " {\n", |
| 59 | + " name = \"John Doe\",\n", |
| 60 | + " age = 42\n", |
| 61 | + " })\n", |
| 62 | + "};\n", |
| 63 | + "var response = await new HttpClient().SendAsync(message);\n", |
| 64 | + "\n", |
| 65 | + "response" |
| 66 | + ] |
| 67 | + } |
| 68 | + ], |
| 69 | + "metadata": { |
| 70 | + "kernelspec": { |
| 71 | + "display_name": ".NET (C#)", |
| 72 | + "language": "C#", |
| 73 | + "name": ".net-csharp" |
| 74 | + }, |
| 75 | + "language_info": { |
| 76 | + "file_extension": ".cs", |
| 77 | + "mimetype": "text/x-csharp", |
| 78 | + "name": "C#", |
| 79 | + "pygments_lexer": "csharp", |
| 80 | + "version": "9.0" |
| 81 | + }, |
| 82 | + "orig_nbformat": 4, |
| 83 | + "vscode": { |
| 84 | + "interpreter": { |
| 85 | + "hash": "ff189401cbcc55bbc67e3f9ce5b9046aa7b4c4752236dc96e578ec1b552e057f" |
| 86 | + } |
| 87 | + } |
| 88 | + }, |
| 89 | + "nbformat": 4, |
| 90 | + "nbformat_minor": 2 |
| 91 | +} |
0 commit comments