Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialokilydokily
12,105 PointsWhy did we need a constructor with no parameter?
. Update: I think I figured out that it is because the { } initialization syntax is implicitly a zero parameter instantiation.
1 Answer
Marcin Siemion
1,412 PointsI believe that it wasn't necessary to have such a constructor, but the way Jeremy did it is very nice. I read more about it here - https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers (Collection initializers). So in order for this to work, we also need Add method implemented in EnumerableCompositor class (according to the MS documentation).