From 145d51efd5f328a0092164ed4cf71178f29cb036 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 26 Oct 2022 14:06:03 +0100 Subject: [PATCH] Add template with code in a Main method This will allow for examples which are just statements. (Also adds example in 16.1 Arrays to show how to use it.) Towards #646 --- standard/arrays.md | 1 + tools/example-templates/code-in-main/Program.cs | 7 +++++++ tools/example-templates/code-in-main/Project.csproj | 11 +++++++++++ 3 files changed, 19 insertions(+) create mode 100644 tools/example-templates/code-in-main/Program.cs create mode 100644 tools/example-templates/code-in-main/Project.csproj diff --git a/standard/arrays.md b/standard/arrays.md index 87702a383..b2bfd67ad 100644 --- a/standard/arrays.md +++ b/standard/arrays.md @@ -10,6 +10,7 @@ The element type of an array can itself be an array type ([ยง16.2.1](arrays.md#1 > *Example*: > +> > ```csharp > int[][] pascals = > { diff --git a/tools/example-templates/code-in-main/Program.cs b/tools/example-templates/code-in-main/Program.cs new file mode 100644 index 000000000..2b701225c --- /dev/null +++ b/tools/example-templates/code-in-main/Program.cs @@ -0,0 +1,7 @@ +class Program +{ + static void Main() + { + $example-code + } +} diff --git a/tools/example-templates/code-in-main/Project.csproj b/tools/example-templates/code-in-main/Project.csproj new file mode 100644 index 000000000..2a1c70ea3 --- /dev/null +++ b/tools/example-templates/code-in-main/Project.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + enable + disable + $example-name + + +