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 trial

C# Querying With LINQ Now You're Querying Selecting, Projecting and Anonymous Types

I'm getting an error from StudentsCode.cs when the only visible document is CodeChallenge.cs.

StudentsCode.cs(15,2): error CS1525: Unexpected symbol }', expecting,' or `;' Compilation failed: 1 error(s), 0 warnings

What does this error have to do with my code?

CodeChallenge.cs
var birds = new[] 
{ 
    new { Name = "Pelican", Color = "White" }, 
    new { Name = "Swan", Color = "White" }, 
    new { Name = "Crow", Color = "Black" } 
};

var mysteryBird = new { Color = "White", Sightings = 3 }

2 Answers

Shlomi Bittan
Shlomi Bittan
6,718 Points

Hi Jason, Your error is caused by a very simple yet important syntax requirement. You forgot to add semicolon at the end of - var mysteryBird = new { Color = "White", Sightings = 3 } - It should be: var mysteryBird = new { Color = "White", Sightings = 3 };

Thank you!