mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-24 18:55:36 +08:00
build
This commit is contained in:
@ -58,10 +58,10 @@ comments: true
|
||||
```csharp title="list.cs"
|
||||
/* 初始化列表 */
|
||||
// 无初始值
|
||||
List<int> nums1 = new();
|
||||
List<int> nums1 = [];
|
||||
// 有初始值
|
||||
int[] numbers = new int[] { 1, 3, 2, 5, 4 };
|
||||
List<int> nums = numbers.ToList();
|
||||
int[] numbers = [1, 3, 2, 5, 4];
|
||||
List<int> nums = [.. numbers];
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@ -704,7 +704,7 @@ comments: true
|
||||
|
||||
```csharp title="list.cs"
|
||||
/* 拼接两个列表 */
|
||||
List<int> nums1 = new() { 6, 8, 7, 10, 9 };
|
||||
List<int> nums1 = [6, 8, 7, 10, 9];
|
||||
nums.AddRange(nums1); // 将列表 nums1 拼接到 nums 之后
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user