Intermediate C#
Q87 / 100

What is collection expressions in C# 12?

Correct! Well done.

Incorrect.

The correct answer is B) A syntax using [ ] to create any collection type with optional spread (..) operator

B

Correct Answer

A syntax using [ ] to create any collection type with optional spread (..) operator

Explanation

int[] a = [1, 2, 3]; List<int> b = [4, 5]; int[] c = [..a, ..b]; Collection expressions work for arrays, spans, and any type with a CollectionBuilder attribute.

Progress
87/100