Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice Encapsulation and Arrays in C#!
You have completed Practice Encapsulation and Arrays in C#!
Preview
In this video, we'll review the solution to the third and final challenge.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
I updated the GetItemAt method to
gracefully handle a bad index.
0:00
To do that,
I used the array's linked property
0:00
to determine if an index was available
before attempting to access it.
0:03
If ( then index, and then what we want to
do is check to see if the index is less
0:07
than the length of the array,
so items.Length).
0:15
Then, we can cut and paste this line
of code inside of our if statement.
0:24
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up