[C# 運算符和表達式 - C# 參考 | Microsoft Learn](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/)
| 運算符 | 類別或名稱 |
| --- | --- |
| [x.y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#member-access-expression-)、[f(x)](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#invocation-expression-)、[a\[i\]](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#indexer-operator-)、[`x?.y`](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#null-conditional-operators--and-)、[`x?[y]`](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#null-conditional-operators--and-)、[x++](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#increment-operator-)、[x--](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#decrement-operator---)、[x!](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/null-forgiving)、[new](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/new-operator)、[typeof](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/type-testing-and-cast#typeof-operator)、[checked](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/keywords/checked)、[unchecked](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/keywords/unchecked)、[default](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/default)、[nameof](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/nameof)、[delegate](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/delegate-operator)、[sizeof](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/sizeof)、[stackalloc](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/stackalloc)、[x->y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-member-access-operator--) | 主要 |
| [+x](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#unary-plus-and-minus-operators)、[\-x](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#unary-plus-and-minus-operators)、[](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#logical-negation-operator-)x[、](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#bitwise-complement-operator-)~x[、](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#increment-operator-)++x[、](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#decrement-operator---)\--x[、](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#index-from-end-operator-)^x[、](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/type-testing-and-cast#cast-expression)(T)x[、](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/await)await[、&&x](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/pointer-related-operators#address-of-operator-)、[\*x](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-indirection-operator-)、[true 和 false](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/true-false-operators) | 一元 |
| [x..y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/member-access-operators#range-operator-) | 范圍 |
| [switch](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/switch-expression)、[with](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/with-expression) | `switch`和`with`表達式 |
| [x \* y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#multiplication-operator-)、[x / y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#division-operator-)、[x % y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#remainder-operator-) | 乘法 |
| [x + y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#addition-operator-)、[x – y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#subtraction-operator--) | 加法 |
| [x > y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#right-shift-operator-) | Shift |
| [x y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/comparison-operators#greater-than-operator-)、[x = y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/comparison-operators#greater-than-or-equal-operator-)、[is](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/type-testing-and-cast#is-operator)、[as](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/type-testing-and-cast#as-operator) | 關系和類型測試 |
| [x == y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/equality-operators#equality-operator-)、[x != y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/equality-operators#inequality-operator-) | 相等 |
| `x & y` | [布爾邏輯 AND](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#logical-and-operator-)或[按位邏輯 AND](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#logical-and-operator-) |
| `x ^ y` | [布爾邏輯 XOR](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#logical-exclusive-or-operator-)或[按位邏輯 XOR](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#logical-exclusive-or-operator-) |
| `x | y` | [布爾邏輯 OR](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#logical-or-operator-)或[按位邏輯 OR](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#logical-or-operator-) |
| [x && y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#conditional-logical-and-operator-) | 條件“與” |
| [x || y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#conditional-logical-or-operator-) | 條件“或” |
| [x ?? y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/null-coalescing-operator) | Null 合并運算符 |
| [c ? t : f](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/conditional-operator) | 條件運算符 |
| [x = y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/assignment-operator)、[x += y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment)、[x -= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment)、[x \*= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment)、[x /= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment)、[x %= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment)、[x &= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#compound-assignment)、[x |= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#compound-assignment)、[x ^= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/boolean-logical-operators#compound-assignment)、[x >= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#compound-assignment)、[x ??= y](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/null-coalescing-operator)、[\=>](https://learn.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/lambda-operator) | 賦值和 lambda 聲明 |
- Visual Studio 2022安裝到非C盤
- .net平臺區別
- 常用單詞
- 關鍵字
- 操作符(運算符)
- 標識符(命名規范)
- 開始
- 變量
- 常量
- 數據類型
- 值類型
- 變量數據類型
- 枚舉類型enum(常量集合)
- 結構類型struct(結構體)
- 元組類型
- 可null類型(T?)
- 引用類型
- 數組(array)
- 集合(List)
- 內置引用類型
- object
- string
- Dynamic(動態類型)
- delegate委托(代理)類型
- 自定義引用類型
- 接口(interface)
- 類class
- record(定義一個引用類型)
- 指針類型(僅用于非安全代碼)
- get和set訪問器
- delegate委托
- delegate實現發布訂閱與事件
- 類型轉換
- 合并操作符??
- 類相關
- Partial 部分類
- 類定義以及訪問修飾符(封裝)
- abstract抽象類與sealed密封類
- virtual虛方法
- 接口interface
- C# 預處理器指令
- C#技術棧
- 判斷(流程控制)與三元運算
- if
- switch
- 三元運算
- 循環
- while 循環
- for循環
- foreach循環
- do...while 循環
- 文件操作
- 其他
- 多開