Debian Codegraph @

tests/data/notebooks/outputs/ipynb_to_myst/csharp.md

raw
1 ---
2 kernelspec:
3 display_name: .NET (C#)
4 language: C#
5 name: .net-csharp
6 ---
7
8 We start with...
9
10 ```{code-cell} csharp
11 Console.WriteLine("Hello World!");
12 ```
13
14 Then we do a plot with Plotly, following the [Plotting with XPlot](https://github.com/dotnet/interactive/blob/master/NotebookExamples/csharp/Docs/Plotting%20with%20Xplot.ipynb) example from `dotnet/interactive`:
15
16 ```{code-cell} csharp
17 using XPlot.Plotly;
18
19 var bar = new Graph.Bar
20 {
21 name = "Bar",
22 x = new[] {'A', 'B', 'C'},
23 y = new[] {1, 3, 2}
24 };
25
26 var chart = Chart.Plot(new[] {bar});
27 chart.WithTitle("A bar plot");
28 display(chart);
29 ```
30
31 We also test the math outputs as in the [Math and Latex](https://github.com/dotnet/interactive/blob/master/NotebookExamples/csharp/Docs/Math%20and%20LaTeX.ipynb) example:
32
33 ```{code-cell} csharp
34 (LaTeXString)@"\begin{align} e^{i \pi} = -1\end{align}"
35 ```
36
37 ```{code-cell} csharp
38 (MathString)@"e^{i \pi} = -1"
39 ```