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 trialAr33ss Leon
4,621 PointsLinq isn't working, is it supposed to be C#?
I'm learning using the Linq tool or library in C#. I don't like to use the workspace so I'm using my Visual Studio program.
In order to show results in the List-Array she types: from b in birds where b.Color == "Red" select b; that doesnt work in my C# Visual Studio. Only this worked: Console.WriteLine(from b in birds where b.Color == "Red" select b); but it doesnt show the array correctly
1 Answer
Steven Parker
231,275 PointsIt sounds like the instructor is evaluating the expression in the REPL, but you are compiling it into a program and using WriteLine to output the value. I'd guess the implicit formatting applied by the REPL is a bit different from what WriteLine does by default.
You may need to construct a loop to ouput the result, possibly applying some formatting manually to get a similar output.
Ar33ss Leon
4,621 PointsAr33ss Leon
4,621 PointsThank you, It helped me to understand this. Yeah I know, I always use a "foreach" to print the values.