Skip to content

Commit

Permalink
doc: update cs.md (#346)
Browse files Browse the repository at this point in the history
* feat(cs.md): Fix logic

* feat(cs.md): Fix show header in logic operator section.

* fix(cs.md): the info from w3school is not correct.

sizeof(bool) == 1, it is 1 byte, but not 1 bit.
  • Loading branch information
qyl27 committed Apr 18, 2023
1 parent 588f84f commit 486ebb1
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions docs/cs.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,20 @@ var bo = false;

```cs
// 单行注释
/* 多行
注释 */
// TODO:向 Visual Studio 中的任务列表添加注释
/// 用于文档的单行注释
/** 多行 注释
用于文档 **/
/*
* 多行
* 注释
*/

// TODO:向IDE中的任务列表添加注释(VS、Rider都支持)
/// XML 单行注释,用于文档
/**
* XML 多行注释,
* 用于文档
*/
```

### 字符串
Expand Down Expand Up @@ -124,7 +132,7 @@ C# 数据类型
### 原始数据类型
<!--rehype:wrap-class=col-span-2-->

| 关键字 | 名称 | System 别名 | 占用空间 | 数据范围 |
| 关键字 | 名称 | System 别名 | 占用空间(Byte) | 数据范围 |
| ------ | ------------ | ----------- | ---------- | ---------------------------------------- |
| bool | 布尔型 | Boolean | 1 | true/false |
| sbyte | 有符号字节型 | SByte | 1 | -128 ~ 127 |
Expand All @@ -138,8 +146,8 @@ C# 数据类型
| char | 字符型 | Char | 8 | UTF-16 所编码的字符 |
| float | 单精度浮点型 | Single | 4 | ±1.5x10^45 ~ ±3.4x10^38 |
| double | 双精度浮点型 | Double | 8 | ±5.0x10^-324 ~ ±1.7x10^308 |
| N/A | 指针型 | IntPtr | 与指针相同 | 与指针相同(受操作系统和处理器位宽影响) |
| N/A | 无符号指针型 | UIntPtr | 与指针相同 | 与指针相同(受操作系统和处理器位宽影响) |
| nint | 指针型 | IntPtr | 与指针相同 | 与指针相同(受操作系统和处理器位宽影响) |
| nuint | 无符号指针型 | UIntPtr | 与指针相同 | 与指针相同(受操作系统和处理器位宽影响) |
<!--rehype:className=show-header-->

### 基本数据类型
Expand Down Expand Up @@ -284,7 +292,7 @@ bool Xor = A ^ B;

C# 中的逻辑运算支持可空布尔类型运算. 注意条件逻辑运算不支持可空布尔类型.

x | y | x&y | x\|y | x^y | !x
x | y | x & y | x \| y | x ^ y | ! x
:- | - | --- | --- | --- | --
true | true | true | true | false | false
true | false | false | true | true | false
Expand All @@ -295,6 +303,7 @@ false | null | false | null | null | true
null | true | null | true | null | null
null | false | false | null | null | null
null | null | null | null | null | null
<!--rehype:className=show-header-->

杂项
-----------
Expand Down

0 comments on commit 486ebb1

Please sign in to comment.