Developer bit
New in C# 12: Collection expressions
Creating collections becomes simpler in C# 12 using collection expressions. We can also make use of the spread operator .. to copy the values from a collection.
Creating collections becomes simpler in C# 12 using collection expressions.
We can also make use of the spread operator .. to copy the values from a collection.
Log(new[] { "one", "two", "three" });Log(["one", "two", "three"]);string[] values = ["one", "two", "three"];Log([.. values, "four", .. (string[])["five", "six"]]);void Log(string[] values) {}
More info can be found in the documentation.
Feel free to update this developer bit on GitHub, thanks in advance!