Imagine this, You have a IPublished content object that you’re using in your view. It is set up like this
var currentPage = Umbraco.CurrentPage();
You can access your property values like so
But when you call any other methods on myProperty such as .HasValue you get an exception as the value throws an exception. Annoying right.
You just need to cast the property as follows
Then you can gain access to the property.