Skip to content

Commit

Permalink
doc: update docs/cs.md #584
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 26, 2024
1 parent 21dc25c commit 2dd3fd1
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions docs/cs.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,6 @@ Console.WriteLine(name); // => John Doe

查看: [C#字符串](#c-字符串)

### 用户输入

```cs showLineNumbers
Console.WriteLine("Enter number:");
if(int.TryParse(Console.ReadLine(),out int input))
{
// 输入验证
Console.WriteLine($"You entered {input}");
}
```

### 变量

```cs
int intNum = 9;
long longNum = 9999999;
float floatNum = 9.99F;
double doubleNum = 99.999;
decimal decimalNum = 99.9999M;
char letter = 'D';
bool @bool = true;
string site = "jaywcjlove.github.io";
var num = 999;
var str = "999";
var bo = false;
```

### 注释

```cs
Expand All @@ -109,6 +82,18 @@ var bo = false;
/// XML 单行注释,用于文档
```

### 用户输入
<!--rehype:wrap-class=col-span-2-->

```cs showLineNumbers
Console.WriteLine("Enter number:");
if(int.TryParse(Console.ReadLine(),out int input))
{
// 输入验证
Console.WriteLine($"You entered {input}");
}
```

### 条件判断

```cs
Expand All @@ -122,19 +107,24 @@ if (j == 10) {
}
```

### 数组
### 变量

```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};
int intNum = 9;
long longNum = 9999999;
float floatNum = 9.99F;
double doubleNum = 99.999;
decimal decimalNum = 99.9999M;
char letter = 'D';
bool @bool = true;
string site = "jaywcjlove.github.io";
var num = 999;
var str = "999";
var bo = false;
```

### 循环
<!--rehype:wrap-class=col-span-2-->
<!--rehype:wrap-class=col-span-2 row-span-2-->

```cs
int[] numbers = {1, 2, 3, 4, 5};
Expand Down Expand Up @@ -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# 数据类型
---------------------

Expand Down

0 comments on commit 2dd3fd1

Please sign in to comment.