From 86fe1e10b313731da4d971dbfb6f416d2f553a0a Mon Sep 17 00:00:00 2001 From: feilong Date: Wed, 15 Dec 2021 15:30:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E8=8A=82=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HelloWorld2.json" | 5 ++ .../HelloWorld2.md" | 59 +++++++++++++++++++ .../config.json" | 4 +- .../sample/Program.cs" | 8 +++ .../sample/sample.csproj" | 10 ++++ .../config.json" | 0 .../config.json" | 0 .../config.json" | 0 .../config.json" | 0 .../config.json" | 0 .../config.json" | 0 11 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.json" create mode 100644 "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.md" create mode 100644 "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/Program.cs" create mode 100644 "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/sample.csproj" rename "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/2.\344\275\277\347\224\250C#\344\270\255\347\232\204\346\226\207\346\234\254\345\200\274\345\222\214\345\217\230\351\207\217\345\200\274\346\235\245\345\255\230\345\202\250\345\222\214\346\243\200\347\264\242\346\225\260\346\215\256/config.json" => "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/2.C#\346\226\207\346\234\254\345\200\274\345\222\214\345\217\230\351\207\217/config.json" (100%) rename "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/3.\345\234\250C#\344\270\255\346\211\247\350\241\214\345\237\272\346\234\254\345\255\227\347\254\246\344\270\262\346\240\274\345\274\217\350\256\276\347\275\256/config.json" => "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/3.C#\345\255\227\347\254\246\344\270\262\346\240\274\345\274\217\350\256\276\347\275\256/config.json" (100%) rename "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/4.\344\275\277\347\224\250C#\345\257\271\346\225\260\345\255\227\346\211\247\350\241\214\345\237\272\346\234\254\350\277\220\347\256\227\346\223\215\344\275\234/config.json" => "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/4.C#\346\225\260\345\255\227\350\277\220\347\256\227\346\223\215\344\275\234/config.json" (100%) rename "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/6.\345\234\250 C# \344\270\255\344\275\277\347\224\250 if-elseif-else \350\257\255\345\217\245\345\260\206\345\206\263\347\255\226\351\200\273\350\276\221\346\267\273\345\212\240\345\210\260\344\273\243\347\240\201\344\270\255/config.json" => "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/6.C# \344\270\255\344\275\277\347\224\250 if-elseif-else \345\210\206\346\224\257\345\210\244\346\226\255/config.json" (100%) rename "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/7.\344\275\277\347\224\250C# \344\270\255\347\232\204\346\225\260\347\273\204\345\222\214 foreach \350\257\255\345\217\245\346\235\245\345\255\230\345\202\250\345\222\214\345\276\252\347\216\257\350\256\277\351\227\256\346\225\260\346\215\256\345\272\217\345\210\227/config.json" => "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/7.C# \346\225\260\347\273\204\345\222\214 foreach \350\257\255\345\217\245/config.json" (100%) rename "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/8.\344\275\277\347\224\250 C# \345\210\233\345\273\272\345\205\267\346\234\211\347\272\246\345\256\232\343\200\201\347\251\272\346\240\274\345\222\214\346\263\250\351\207\212\347\232\204\346\230\223\350\257\273\344\273\243\347\240\201/config.json" => "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/8.C# \347\274\226\347\240\201\350\247\204\350\214\203/config.json" (100%) diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.json" new file mode 100644 index 0000000..839fee1 --- /dev/null +++ "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.json" @@ -0,0 +1,5 @@ +{ + "type": "code_options", + "author": "huanhuilong", + "source": "HelloWorld2.md" +} \ No newline at end of file diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.md" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.md" new file mode 100644 index 0000000..118f063 --- /dev/null +++ "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/HelloWorld2.md" @@ -0,0 +1,59 @@ +# 第一个完整的C#程序 + +前一章的习题里我们已经使用C#10.0 的方式,写了一些C#全局代码。在更早的版本里,则需要编写完整的C#代码。例如: + +```csharp +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Program{ + public class Program{ + public static void Main(string[] args){ + // C# 代码 + } + } +} +``` + +在C# 10.0 里一下代码错误的是? + +## 答案 + +```csharp +WriteLine("Hello, World!"); +``` + +## 选项 + +### 完整的C#代码 + +```csharp +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Program{ + public class Program{ + public static void Main(string[] args){ + Console.WriteLine("Hello, World!"); + } + } +} +``` + +### 不使用using + +```csharp +public class Program{ + public static void Main(string[] args){ + Console.WriteLine("Hello, World!"); + } +} +``` + +### 全局代码 + +```csharp +Console.WriteLine("Hello, World!"); +``` diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/config.json" index b4e4708..f27d6eb 100644 --- "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/config.json" +++ "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/config.json" @@ -2,5 +2,7 @@ "node_id": "csharp-8f63c0182bed428cb2c75bc1d10a6502", "keywords": [], "children": [], - "export": [] + "export": [ + "HelloWorld2.json" + ] } \ No newline at end of file diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/Program.cs" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/Program.cs" new file mode 100644 index 0000000..715eb61 --- /dev/null +++ "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/Program.cs" @@ -0,0 +1,8 @@ +// See https://aka.ms/new-console-template for more information + +public class Program{ + public static void Main(string[] args){ + Console.WriteLine("Hello, World!"); + } +} + diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/sample.csproj" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/sample.csproj" new file mode 100644 index 0000000..40c60dd --- /dev/null +++ "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/1.\347\274\226\345\206\231\347\254\254\344\270\200\344\270\252C#\344\273\243\347\240\201/sample/sample.csproj" @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/2.\344\275\277\347\224\250C#\344\270\255\347\232\204\346\226\207\346\234\254\345\200\274\345\222\214\345\217\230\351\207\217\345\200\274\346\235\245\345\255\230\345\202\250\345\222\214\346\243\200\347\264\242\346\225\260\346\215\256/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/2.C#\346\226\207\346\234\254\345\200\274\345\222\214\345\217\230\351\207\217/config.json" similarity index 100% rename from "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/2.\344\275\277\347\224\250C#\344\270\255\347\232\204\346\226\207\346\234\254\345\200\274\345\222\214\345\217\230\351\207\217\345\200\274\346\235\245\345\255\230\345\202\250\345\222\214\346\243\200\347\264\242\346\225\260\346\215\256/config.json" rename to "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/2.C#\346\226\207\346\234\254\345\200\274\345\222\214\345\217\230\351\207\217/config.json" diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/3.\345\234\250C#\344\270\255\346\211\247\350\241\214\345\237\272\346\234\254\345\255\227\347\254\246\344\270\262\346\240\274\345\274\217\350\256\276\347\275\256/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/3.C#\345\255\227\347\254\246\344\270\262\346\240\274\345\274\217\350\256\276\347\275\256/config.json" similarity index 100% rename from "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/3.\345\234\250C#\344\270\255\346\211\247\350\241\214\345\237\272\346\234\254\345\255\227\347\254\246\344\270\262\346\240\274\345\274\217\350\256\276\347\275\256/config.json" rename to "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/3.C#\345\255\227\347\254\246\344\270\262\346\240\274\345\274\217\350\256\276\347\275\256/config.json" diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/4.\344\275\277\347\224\250C#\345\257\271\346\225\260\345\255\227\346\211\247\350\241\214\345\237\272\346\234\254\350\277\220\347\256\227\346\223\215\344\275\234/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/4.C#\346\225\260\345\255\227\350\277\220\347\256\227\346\223\215\344\275\234/config.json" similarity index 100% rename from "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/4.\344\275\277\347\224\250C#\345\257\271\346\225\260\345\255\227\346\211\247\350\241\214\345\237\272\346\234\254\350\277\220\347\256\227\346\223\215\344\275\234/config.json" rename to "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/4.C#\346\225\260\345\255\227\350\277\220\347\256\227\346\223\215\344\275\234/config.json" diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/6.\345\234\250 C# \344\270\255\344\275\277\347\224\250 if-elseif-else \350\257\255\345\217\245\345\260\206\345\206\263\347\255\226\351\200\273\350\276\221\346\267\273\345\212\240\345\210\260\344\273\243\347\240\201\344\270\255/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/6.C# \344\270\255\344\275\277\347\224\250 if-elseif-else \345\210\206\346\224\257\345\210\244\346\226\255/config.json" similarity index 100% rename from "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/6.\345\234\250 C# \344\270\255\344\275\277\347\224\250 if-elseif-else \350\257\255\345\217\245\345\260\206\345\206\263\347\255\226\351\200\273\350\276\221\346\267\273\345\212\240\345\210\260\344\273\243\347\240\201\344\270\255/config.json" rename to "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/6.C# \344\270\255\344\275\277\347\224\250 if-elseif-else \345\210\206\346\224\257\345\210\244\346\226\255/config.json" diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/7.\344\275\277\347\224\250C# \344\270\255\347\232\204\346\225\260\347\273\204\345\222\214 foreach \350\257\255\345\217\245\346\235\245\345\255\230\345\202\250\345\222\214\345\276\252\347\216\257\350\256\277\351\227\256\346\225\260\346\215\256\345\272\217\345\210\227/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/7.C# \346\225\260\347\273\204\345\222\214 foreach \350\257\255\345\217\245/config.json" similarity index 100% rename from "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/7.\344\275\277\347\224\250C# \344\270\255\347\232\204\346\225\260\347\273\204\345\222\214 foreach \350\257\255\345\217\245\346\235\245\345\255\230\345\202\250\345\222\214\345\276\252\347\216\257\350\256\277\351\227\256\346\225\260\346\215\256\345\272\217\345\210\227/config.json" rename to "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/7.C# \346\225\260\347\273\204\345\222\214 foreach \350\257\255\345\217\245/config.json" diff --git "a/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/8.\344\275\277\347\224\250 C# \345\210\233\345\273\272\345\205\267\346\234\211\347\272\246\345\256\232\343\200\201\347\251\272\346\240\274\345\222\214\346\263\250\351\207\212\347\232\204\346\230\223\350\257\273\344\273\243\347\240\201/config.json" "b/data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/8.C# \347\274\226\347\240\201\350\247\204\350\214\203/config.json" similarity index 100% rename from "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/8.\344\275\277\347\224\250 C# \345\210\233\345\273\272\345\205\267\346\234\211\347\272\246\345\256\232\343\200\201\347\251\272\346\240\274\345\222\214\346\263\250\351\207\212\347\232\204\346\230\223\350\257\273\344\273\243\347\240\201/config.json" rename to "data/1..NET\345\210\235\351\230\266/2.C#\350\257\255\346\263\225/8.C# \347\274\226\347\240\201\350\247\204\350\214\203/config.json" -- GitLab