[.NET] Use collection expressions

As of C# 12 we can now use collection expressions to reduce some boilerplate when initializing collections.
This commit is contained in:
Raul Santos
2024-12-21 03:26:14 +01:00
parent 6d5fd9acc8
commit cea78730d0
14 changed files with 69 additions and 65 deletions

View File

@@ -212,7 +212,7 @@ to said method.
// Outputs "Hello there!" twice, once per line.
myGDScriptNode.Call("print_n_times", "Hello there!", 2);
string[] arr = new string[] { "a", "b", "c" };
string[] arr = ["a", "b", "c"];
// Output: "a", "b", "c" (one per line).
myGDScriptNode.Call("print_array", arr);
// Output: "1", "2", "3" (one per line).