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 trialKyaw Tun Sein
2,291 PointsAt 8:33, the tutor doesn't explain why run time error if Documents is not instantiated to a new List<Document>. So, why?
Thanks for the comment Steven. Here is the video link: https://teamtreehouse.com/library/text-analytics-api-part-1
1 Answer
Steven Parker
231,186 PointsWithout initialization, you'd be trying to access the .Add() method of null.
This would of course produce an error. Unless established in the constructor, the properties of a newly created object (such as sentimentRequest here) are all null.
So to be able to use the .Add() method, the Document must first be initialized to an empty list.
Steven Parker
231,186 PointsSteven Parker
231,186 PointsYou gave the time index, but you forgot to include a link to the video itself.