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 trialFahmi Eshaq
3,002 PointsWhy does the keyword Entry squiggle in this statement: Entry.IntensityLevel.High?
In _EntryForm, the statement Entry.IntensityLevel.Low have a squiggle under Entry although we added the model directive @model Treehouse.FitnessFrog.Models.Entry at the beginning of _EntryForm.
What is the difference between @using Treehouse.FitnessFrog.Models AND @model Treehouse.FitnessFrog.Models.Entry? They both refer to the same resource except that @model points to Entry class specifically.
1 Answer
Steven Parker
231,269 PointsThe using directive can point to any namespace you may want to reference.
And you might have more than one using directive. In this case, it happens that elements of the same namespace as the model are being referenced, so the two are similar.
But the purpose is different, model defines the type of the passed in data model (and there can be only one), and using allows you to make references in the code to namespace elements without fully specifying them.
The "squiggle" is VS warning that it doesn't recognize the term "Entry". But once the using is added, it goes away.