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 trialNathan Reinauer
2,097 PointsWhat object is being created in System.DateTime.AddDays() ? It looks like it's calling directly on class DateTime
In the same way that System.Console.WriteLine() is static, shouldn't System.DateTime.AddDays() be considered static? I chose "static" on the quiz and got it wrong
1 Answer
Seth Kroger
56,413 PointsIf you look at the docs for DateTime.AddDays() you should see that the method isn't defined as static. This make sense because you need a DateTime object with a specified date to add days to it. It only kinda looks like a static call due to the ClassName.MethodName convention of documenting methods. Since instance methods are called from instance variables and they can be named anything it's better to use the class name instead.