Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Objects Encapsulation and Arrays Arrays

Keep getting errors when compiling favoriteThings.length ..not sure what I'm doing wrong here

I keep getting errors when compiling the favoriteThings.length . I'm not sure where I'm going wrong here. Here's my code:

csharp> string[] favoriteThings = new string[3]{"sunshine", "presents", "babies"
csharp> favoriteThings                                                          
{ "sunshine", "presents", "babies" }                                            
csharp> favoriteThings.length                                                   
(1,17): error CS1061: Type `string[]' does not contain a definition for `length'
 and no extension method `length' of type `string[]' could be found. Are you mis
sing an assembly reference?                                                     
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error

Here's my workspace snapshot, though I'm not sure you can view the Exceptions.cs console: link

1 Answer

Hi, try using favoriteThings.Length (with an uppercase L) instead. C# can be really picky at times... ;)