diff --git a/docs/cs.md b/docs/cs.md index 2386e16..157b9b1 100644 --- a/docs/cs.md +++ b/docs/cs.md @@ -67,7 +67,23 @@ Console.WriteLine(name); // => John Doe 查看: [C#字符串](#c-字符串) +### 注释 + +```cs +// 单行注释 + +/* + * 多行 + * 注释 - 用于文档 + */ + +// TODO: +// 向IDE中的任务列表添加注释(VS、Rider都支持) +/// XML 单行注释,用于文档 +``` + ### 用户输入 + ```cs showLineNumbers Console.WriteLine("Enter number:"); @@ -78,6 +94,19 @@ if(int.TryParse(Console.ReadLine(),out int input)) } ``` +### 条件判断 + +```cs +int j = 10; +if (j == 10) { + Console.WriteLine("I get printed"); +} else if (j > 10) { + Console.WriteLine("I don't"); +} else { + Console.WriteLine("I also don't"); +} +``` + ### 变量 ```cs @@ -94,47 +123,8 @@ var str = "999"; var bo = false; ``` -### 注释 - -```cs -// 单行注释 - -/* - * 多行 - * 注释 - 用于文档 - */ - -// TODO: -// 向IDE中的任务列表添加注释(VS、Rider都支持) -/// XML 单行注释,用于文档 -``` - -### 条件判断 - -```cs -int j = 10; -if (j == 10) { - Console.WriteLine("I get printed"); -} else if (j > 10) { - Console.WriteLine("I don't"); -} else { - Console.WriteLine("I also don't"); -} -``` - -### 数组 - -```cs -char[] chars = new char[10]; -chars[0] = 'a'; -chars[1] = 'b'; -string[] letters = {"A", "B", "C"}; -int[] mylist = {100, 200}; -bool[] answers = {true, false}; -``` - ### 循环 - + ```cs int[] numbers = {1, 2, 3, 4, 5}; @@ -169,6 +159,17 @@ do } while( true ); ``` +### 数组 + +```cs +char[] chars = new char[10]; +chars[0] = 'a'; +chars[1] = 'b'; +string[] letters = {"A", "B", "C"}; +int[] mylist = {100, 200}; +bool[] answers = {true, false}; +``` + C# 数据类型 ---------------------