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

Jason Finley
Jason Finley
12,200 Points

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
5,055 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 };