Initial Obsidian notes backup

This commit is contained in:
2026-06-18 20:01:30 +08:00
parent 02810617db
commit ebb9e385c5
17 changed files with 1639 additions and 22 deletions
+23 -3
View File
@@ -13,10 +13,30 @@
在函数传参时,两边都要加上修饰词
ref
```Csharp
static void ChangeValueref value
ChangeValueref a
//交换数字
void Swap(ref int a, ref int b)
{
int temp = a; a = b; b = temp;
}
```
out:
```Csharp
//最经典:int.TryParse
if (int.TryParse(Console.ReadLine(), out int value))
Console.WriteLine(value % 2 == 0 ? "even" : "odd");
//int.TryParse伪代码
//bool ReadConfig(string key, out string value)
//{
// if (配置存在)
// {
// value = 读取到的值; return true;
// }
// else
// {
// value = null; return false;
// }
//}
```
案例:
原型在[[值类型和引用类型]]笔记中