C# includes a method for initializing Lists that means you do not need to repeatedly Add("foo")
throughout your code. This allows you to specify a set of items immediately after the Lists constructor that causes the items to be sequentially added to the list after its created for you. This works for most collection types including Arrays and Lists.
Here’s an example of what constructing a list like this might look like.
|
|
Doing this traditionally would look like this:
|
|
This trick also works with Dictionary’s! Here’s how: https://youtu.be/lFsgmxzw7IU
Join the World of Zero Discord server: https://discord.gg/hU5Kq2u