新版本的变更 / C# 12.0

using System;
using System.Collections.Generic;
using System.Linq;

//before:
int[] first1 = { 123 };
var second1 = new List<int> { 456 };

int[] all1 = first1.Union(second1).ToArray();
//all1 is { 1, 2, 3, 4, 5, 6 }

//in version 12:
List<int> first2 = [123];
int[] second2 = [56];
int[] all2 = [.. first2, 4, .. second2];
//all1 is { 1, 2, 3, 4, 5, 6 }

Console.WriteLine(string.Join(", ", all1));
Console.WriteLine(string.Join(", ", all2));