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 trialLuke Walz
5,271 PointsDid you create a "Color" property on your "mysteryBird" variable?
I am not sure what the issue with my code is. If I am able to write the property "Color" of the variable mysteryBird, how have I failed to create it?
var birds = new[]
{
new { Name = "Pelican", Color = "White" },
new { Name = "Swan", Color = "White" },
new { Name = "Crow", Color = "Black" }
};
var mysteryBird = new[]
{
new { Color = "White", Sightings = 3 },
};
Console.Write(mysteryBird[0].Color + mysteryBird[0].Sightings);
1 Answer
Steven Parker
231,248 PointsYou created an array containing one object.
It looks like you followed the example of the birds array that was provided to start with. But for task 1, the challenge just wants you to create an individual object:
var mysteryBird = new { Color = "White", Sightings = 3 };