I have a very beginning C# question. Suppose I have a class called GameObject, and I want to create an array of GameObject entities. I could think
With LINQ, you can transform the array of uninitialized elements into the new collection of created objects with one line of code.
var houses = new GameObject[200].Select(h => new GameObject()).ToArray();
Actually, you can use any other source for this, even generated sequence of integers:
var houses = Enumerable.Repeat(0, 200).Select(h => new GameObject()).ToArray();
However, the first case seems to me more readable, although the type of original sequence is not important.